Repository: incubator-carbondata
Updated Branches:
  refs/heads/12-dev ebf70bca8 -> 1513700b5


[CARBONDATA-935] Define PartitionInfo model

fix javastyle error

modify partitioninfo and singlePartition

modify schema.thrift to add partitioningList

modify definition


Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/ac978ad4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/ac978ad4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/ac978ad4

Branch: refs/heads/12-dev
Commit: ac978ad4b049d89c53e3904c9aa4f54f4e8abdaa
Parents: ebf70bc
Author: lucao <whuca...@gmail.com>
Authored: Tue Apr 18 14:52:18 2017 +0800
Committer: chenliang613 <chenliang...@huawei.com>
Committed: Wed Apr 19 23:38:48 2017 +0800

----------------------------------------------------------------------
 .../core/metadata/schema/PartitionInfo.java     | 88 +++++++++++++++++++
 .../metadata/schema/partition/Partitioning.java | 27 ++++++
 .../schema/partition/SinglePartition.java       | 92 ++++++++++++++++++++
 .../core/metadata/schema/table/TableSchema.java | 14 +++
 format/src/main/thrift/schema.thrift            | 26 ++++++
 5 files changed, 247 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ac978ad4/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
new file mode 100644
index 0000000..a0b87cf
--- /dev/null
+++ 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.core.metadata.schema;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.carbondata.core.metadata.schema.partition.Partitioning;
+import org.apache.carbondata.core.metadata.schema.partition.SinglePartition;
+import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
+
+/**
+ * Partition information
+ */
+public class PartitionInfo implements Serializable {
+
+  /**
+   * Partition numbers
+   */
+  private int numberOfPartitions;
+
+  /**
+   * Partition columns
+   */
+  private List<ColumnSchema> columnSchemaList;
+
+  /**
+   * partition type
+   */
+  private Partitioning partitioning;
+
+  /**
+   * Partition list
+   */
+  private List<SinglePartition> partitionList;
+
+  /**
+   * @param columnSchemaList
+   * @param partitioning
+   */
+  public PartitionInfo(List<ColumnSchema> columnSchemaList, Partitioning 
partitioning) {
+    this.columnSchemaList = columnSchemaList;
+    this.partitioning = partitioning;
+  }
+
+  /**
+   * @param columnSchemaList
+   * @param partitioning
+   * @param numberOfPartitions
+   */
+  public PartitionInfo(List<ColumnSchema> columnSchemaList, Partitioning 
partitioning,
+      int numberOfPartitions) {
+    this(columnSchemaList, partitioning);
+    this.numberOfPartitions = numberOfPartitions;
+  }
+
+  public List<ColumnSchema> getColumnSchemaList() {
+    return columnSchemaList;
+  }
+
+  public Partitioning getPartitioning() {
+    return partitioning;
+  }
+
+  public int getNumberOfPartitions() {
+    return  numberOfPartitions;
+  }
+
+  public List<SinglePartition> getPartitionList() {
+    return partitionList;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ac978ad4/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/Partitioning.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/Partitioning.java
 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/Partitioning.java
new file mode 100644
index 0000000..ca1d95b
--- /dev/null
+++ 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/Partitioning.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.carbondata.core.metadata.schema.partition;
+
+/**
+ * Partition type supported in carbon
+ */
+public enum Partitioning {
+  RANGE,
+  RANGE_INTERVAL,
+  LIST,
+  HASH
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ac978ad4/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/SinglePartition.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/SinglePartition.java
 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/SinglePartition.java
new file mode 100644
index 0000000..fe36e14
--- /dev/null
+++ 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/partition/SinglePartition.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.carbondata.core.metadata.schema.partition;
+
+import java.io.Serializable;
+import java.util.List;
+
+public class SinglePartition implements Serializable {
+
+  /**
+   * partition id
+   */
+  private int partition_id;
+
+  /**
+   * partition name
+   */
+  private String partition_name;
+
+  /**
+   * boundary value list for multi-level partition
+   */
+  private List<String> boundary_value_list;
+
+  /**
+   *
+   * @param value_list
+   */
+  public SinglePartition(List<String> value_list) {
+    this.boundary_value_list = value_list;
+  }
+
+  /**
+   *
+   * @param partition_name
+   * @param value_list
+   */
+  public SinglePartition(String partition_name, List<String> value_list) {
+    this(value_list);
+    this.partition_name = partition_name;
+  }
+
+  /**
+   * @param id
+   */
+  public void setPartitionId(int id) {
+    this.partition_id = id;
+  }
+
+  public int getPartition_id() {
+    return partition_id;
+  }
+
+  /**
+   * @param value_list
+   */
+  public void setBoundaryValue(List<String> value_list) {
+    this.boundary_value_list = value_list;
+  }
+
+  /**
+   * @return boundary_value_list
+   */
+  public List<String> getBoundaryValue() {
+    return boundary_value_list;
+  }
+
+  /**
+   * @param partitionName
+   */
+  public void setPartitionName(String partitionName) {
+    this.partition_name = partitionName;
+  }
+
+  public String getPartitionName() {
+    return partition_name;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ac978ad4/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
index 179f4d4..ad2730b 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/metadata/schema/table/TableSchema.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.metadata.schema.BucketingInfo;
+import org.apache.carbondata.core.metadata.schema.PartitionInfo;
 import org.apache.carbondata.core.metadata.schema.SchemaEvolution;
 import org.apache.carbondata.core.metadata.schema.table.column.ColumnSchema;
 
@@ -66,6 +67,11 @@ public class TableSchema implements Serializable {
    */
   private BucketingInfo bucketingInfo;
 
+  /**
+   * Information about partition type, partition column, numbers
+   */
+  private PartitionInfo partitionInfo;
+
   public TableSchema() {
     this.listOfColumns = new 
ArrayList<ColumnSchema>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
   }
@@ -184,4 +190,12 @@ public class TableSchema implements Serializable {
   public void setBucketingInfo(BucketingInfo bucketingInfo) {
     this.bucketingInfo = bucketingInfo;
   }
+
+  public PartitionInfo getPartitionInfo() {
+    return partitionInfo;
+  }
+
+  public void setpartitionInfo(PartitionInfo partitionInfo) {
+    this.partitionInfo = partitionInfo;
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ac978ad4/format/src/main/thrift/schema.thrift
----------------------------------------------------------------------
diff --git a/format/src/main/thrift/schema.thrift 
b/format/src/main/thrift/schema.thrift
index fba70ea..91ff6e3 100644
--- a/format/src/main/thrift/schema.thrift
+++ b/format/src/main/thrift/schema.thrift
@@ -49,6 +49,12 @@ enum Encoding{
        DIRECT_DICTIONARY = 5; // Identifies that a column is direct dictionary 
encoded
 }
 
+enum Partitioning{
+  RANGE = 0;
+  RANGE_INTERVAL = 1;
+  LIST = 2;
+  HASH = 3;
+}
 
 /**
  * Description of a Column for both dimension and measure
@@ -121,6 +127,25 @@ struct SchemaEvolution{
 }
 
 /**
+ * One partition in table
+ */
+struct SinglePartition{
+    1: optional i32 partition_id;
+    2: required list<string> boundary_value_list;
+    3: optional string partition_name;
+}
+
+/**
+ * Partition information of table
+ */
+struct PartitionInfo{
+    1: required list<ColumnSchema> partition_columns;
+    2: required Partitioning partitioning;
+    3: optional list<SinglePartition> partition_list;
+    4: optional i32 number_of_partitions;
+}
+
+/**
  * Bucketing information of fields on table
  */
 struct BucketingInfo{
@@ -137,6 +162,7 @@ struct TableSchema{
        3: required SchemaEvolution schema_evolution; // History of schema 
evolution of this table
   4: optional map<string,string> tableProperties; // Table properties 
configured by the user
   5: optional BucketingInfo bucketingInfo; // Bucketing information
+  6: optional PartitionInfo partitionInfo; // Partition information
 }
 
 struct TableInfo{

Reply via email to