PageRenderTime 34ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/ql/src/java/org/apache/hadoop/hive/ql/plan/AddPartitionDesc.java

#
Java | 140 lines | 54 code | 16 blank | 70 comment | 0 complexity | 3879c8293c8ed9c6689940386e9f6d48 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. package org.apache.hadoop.hive.ql.plan;
  19. import java.io.Serializable;
  20. import java.util.HashMap;
  21. import java.util.LinkedHashMap;
  22. import java.util.Map;
  23. /**
  24. * Contains the information needed to add a partition.
  25. */
  26. public class AddPartitionDesc extends DDLDesc implements Serializable {
  27. private static final long serialVersionUID = 1L;
  28. String tableName;
  29. String dbName;
  30. String location;
  31. boolean ifNotExists;
  32. LinkedHashMap<String, String> partSpec;
  33. /**
  34. * For serialization only.
  35. */
  36. public AddPartitionDesc() {
  37. }
  38. /**
  39. * @param dbName
  40. * database to add to.
  41. * @param tableName
  42. * table to add to.
  43. * @param partSpec
  44. * partition specification.
  45. * @param location
  46. * partition location, relative to table location.
  47. * @param ifNotExists
  48. * if true, the partition is only added if it doesn't exist
  49. */
  50. public AddPartitionDesc(String dbName, String tableName,
  51. Map<String, String> partSpec, String location, boolean ifNotExists) {
  52. super();
  53. this.dbName = dbName;
  54. this.tableName = tableName;
  55. this.partSpec = new LinkedHashMap<String,String>(partSpec);
  56. this.location = location;
  57. this.ifNotExists = ifNotExists;
  58. }
  59. /**
  60. * @return database name
  61. */
  62. public String getDbName() {
  63. return dbName;
  64. }
  65. /**
  66. * @param dbName
  67. * database name
  68. */
  69. public void setDbName(String dbName) {
  70. this.dbName = dbName;
  71. }
  72. /**
  73. * @return the table we're going to add the partitions to.
  74. */
  75. public String getTableName() {
  76. return tableName;
  77. }
  78. /**
  79. * @param tableName
  80. * the table we're going to add the partitions to.
  81. */
  82. public void setTableName(String tableName) {
  83. this.tableName = tableName;
  84. }
  85. /**
  86. * @return location of partition in relation to table
  87. */
  88. public String getLocation() {
  89. return location;
  90. }
  91. /**
  92. * @param location
  93. * location of partition in relation to table
  94. */
  95. public void setLocation(String location) {
  96. this.location = location;
  97. }
  98. /**
  99. * @return partition specification.
  100. */
  101. public LinkedHashMap<String, String> getPartSpec() {
  102. return partSpec;
  103. }
  104. /**
  105. * @param partSpec
  106. * partition specification
  107. */
  108. public void setPartSpec(LinkedHashMap<String, String> partSpec) {
  109. this.partSpec = partSpec;
  110. }
  111. /**
  112. * @return if the partition should only be added if it doesn't exist already
  113. */
  114. public boolean getIfNotExists() {
  115. return this.ifNotExists;
  116. }
  117. /**
  118. * @param ifNotExists
  119. * if the part should be added only if it doesn't exist
  120. */
  121. public void setIfNotExists(boolean ifNotExists) {
  122. this.ifNotExists = ifNotExists;
  123. }
  124. }