[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-12-14 Thread chenerlu
Github user chenerlu closed the pull request at:

https://github.com/apache/carbondata/pull/1103


---


[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-07-10 Thread mayunSaicmotor
Github user mayunSaicmotor commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1103#discussion_r126377929
  
--- Diff: 
examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala
 ---
@@ -113,14 +113,31 @@ object CarbonPartitionExample {
| 'LIST_INFO'='(China,United States),UK ,japan,(Canada,Russia), 
South Korea ')
""".stripMargin)
 
+// range interval partition
+spark.sql("DROP TABLE IF EXISTS t7")
+
+spark.sql("""
+| CREATE TABLE IF NOT EXISTS t7
+| (
+| vin String,
+| phonenumber Long,
+| country String,
+| area String
+| )
+| PARTITIONED BY (logdate Timestamp)
+| STORED BY 'carbondata'
+| TBLPROPERTIES('PARTITION_TYPE'='RANGE_INTERVAL',
+| 'RANGE_INTERVAL_INFO'='2014/01/01, 2015/01/01, month')
+  """.stripMargin)
+
 // show tables
 spark.sql("SHOW TABLES").show()
 
 // drop table
 spark.sql("DROP TABLE IF EXISTS t0")
 spark.sql("DROP TABLE IF EXISTS t1")
 spark.sql("DROP TABLE IF EXISTS t3")
-spark.sql("DROP TABLE IF EXISTS t5")
+spark.sql("DROP TABLE IF EXISTS t7")
--- End diff --

where is the drop table for t5?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-07-10 Thread mayunSaicmotor
Github user mayunSaicmotor commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1103#discussion_r126377354
  
--- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
 ---
@@ -355,6 +355,189 @@ class TestDDLForPartitionTable  extends QueryTest 
with BeforeAndAfterAll {
 assert(exception_test_range_decimal.getMessage.contains("Invalid 
partition definition"))
   }
 
+  test("create partition table: range interval partition in year") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalYearTable (empno 
int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+| PARTITIONED BY (doj Timestamp)
+| STORED BY 'org.apache.carbondata.format'
+| TBLPROPERTIES('PARTITION_TYPE'='RANGE_INTERVAL',
+| 'RANGE_INTERVAL_INFO'='2017-06-11 00:00:02, 2017-06-13 23:59:59, 
year')
+  """.stripMargin)
+
+val carbonTable = 
CarbonMetadata.getInstance().getCarbonTable("default_rangeIntervalYearTable")
+val partitionInfo = 
carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+assert(partitionInfo != null)
+
assert(partitionInfo.getColumnSchemaList.get(0).getColumnName.equalsIgnoreCase("doj"))
+assert(partitionInfo.getColumnSchemaList.get(0).getDataType == 
DataType.TIMESTAMP)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.size 
== 3)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(0) 
== Encoding.DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(1) 
== Encoding.DIRECT_DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(2) 
== Encoding.INVERTED_INDEX)
+assert(partitionInfo.getPartitionType == PartitionType.RANGE_INTERVAL)
+assert(partitionInfo.getRangeIntervalInfo.size == 3)
+assert(partitionInfo.getRangeIntervalInfo.get(0).equals("2017-06-11 
00:00:02"))
+assert(partitionInfo.getRangeIntervalInfo.get(1).equals("2017-06-13 
23:59:59"))
+assert(partitionInfo.getRangeIntervalInfo.get(2).equals("year"))
+  }
+
+  test("create partition table: range interval partition in month") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalMonthTable 
(empno int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+| PARTITIONED BY (doj Timestamp)
+| STORED BY 'org.apache.carbondata.format'
+| TBLPROPERTIES('PARTITION_TYPE'='RANGE_INTERVAL',
+| 'RANGE_INTERVAL_INFO'='2017-06-11 00:00:02, 2017-06-13 23:59:59, 
month')
+  """.stripMargin)
+
+val carbonTable = 
CarbonMetadata.getInstance().getCarbonTable("default_rangeIntervalMonthTable")
+val partitionInfo = 
carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+assert(partitionInfo != null)
+
assert(partitionInfo.getColumnSchemaList.get(0).getColumnName.equalsIgnoreCase("doj"))
+assert(partitionInfo.getColumnSchemaList.get(0).getDataType == 
DataType.TIMESTAMP)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.size 
== 3)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(0) 
== Encoding.DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(1) 
== Encoding.DIRECT_DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(2) 
== Encoding.INVERTED_INDEX)
+assert(partitionInfo.getPartitionType == PartitionType.RANGE_INTERVAL)
+assert(partitionInfo.getRangeIntervalInfo.size == 3)
+assert(partitionInfo.getRangeIntervalInfo.get(0).equals("2017-06-11 
00:00:02"))
+assert(partitionInfo.getRangeIntervalInfo.get(1).equals("2017-06-13 
23:59:59"))
+assert(partitionInfo.getRangeIntervalInfo.get(2).equals("month"))
+  }
+
+  test("create partition table: range interval partition in week") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalWeekTable (empno 
int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+  

[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-07-10 Thread mayunSaicmotor
Github user mayunSaicmotor commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1103#discussion_r126376641
  
--- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestDDLForPartitionTable.scala
 ---
@@ -355,6 +355,189 @@ class TestDDLForPartitionTable  extends QueryTest 
with BeforeAndAfterAll {
 assert(exception_test_range_decimal.getMessage.contains("Invalid 
partition definition"))
   }
 
+  test("create partition table: range interval partition in year") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalYearTable (empno 
int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+| PARTITIONED BY (doj Timestamp)
+| STORED BY 'org.apache.carbondata.format'
+| TBLPROPERTIES('PARTITION_TYPE'='RANGE_INTERVAL',
+| 'RANGE_INTERVAL_INFO'='2017-06-11 00:00:02, 2017-06-13 23:59:59, 
year')
+  """.stripMargin)
+
+val carbonTable = 
CarbonMetadata.getInstance().getCarbonTable("default_rangeIntervalYearTable")
+val partitionInfo = 
carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+assert(partitionInfo != null)
+
assert(partitionInfo.getColumnSchemaList.get(0).getColumnName.equalsIgnoreCase("doj"))
+assert(partitionInfo.getColumnSchemaList.get(0).getDataType == 
DataType.TIMESTAMP)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.size 
== 3)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(0) 
== Encoding.DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(1) 
== Encoding.DIRECT_DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(2) 
== Encoding.INVERTED_INDEX)
+assert(partitionInfo.getPartitionType == PartitionType.RANGE_INTERVAL)
+assert(partitionInfo.getRangeIntervalInfo.size == 3)
+assert(partitionInfo.getRangeIntervalInfo.get(0).equals("2017-06-11 
00:00:02"))
+assert(partitionInfo.getRangeIntervalInfo.get(1).equals("2017-06-13 
23:59:59"))
+assert(partitionInfo.getRangeIntervalInfo.get(2).equals("year"))
+  }
+
+  test("create partition table: range interval partition in month") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalMonthTable 
(empno int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+| PARTITIONED BY (doj Timestamp)
+| STORED BY 'org.apache.carbondata.format'
+| TBLPROPERTIES('PARTITION_TYPE'='RANGE_INTERVAL',
+| 'RANGE_INTERVAL_INFO'='2017-06-11 00:00:02, 2017-06-13 23:59:59, 
month')
+  """.stripMargin)
+
+val carbonTable = 
CarbonMetadata.getInstance().getCarbonTable("default_rangeIntervalMonthTable")
+val partitionInfo = 
carbonTable.getPartitionInfo(carbonTable.getFactTableName)
+assert(partitionInfo != null)
+
assert(partitionInfo.getColumnSchemaList.get(0).getColumnName.equalsIgnoreCase("doj"))
+assert(partitionInfo.getColumnSchemaList.get(0).getDataType == 
DataType.TIMESTAMP)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.size 
== 3)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(0) 
== Encoding.DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(1) 
== Encoding.DIRECT_DICTIONARY)
+assert(partitionInfo.getColumnSchemaList.get(0).getEncodingList.get(2) 
== Encoding.INVERTED_INDEX)
+assert(partitionInfo.getPartitionType == PartitionType.RANGE_INTERVAL)
+assert(partitionInfo.getRangeIntervalInfo.size == 3)
+assert(partitionInfo.getRangeIntervalInfo.get(0).equals("2017-06-11 
00:00:02"))
+assert(partitionInfo.getRangeIntervalInfo.get(1).equals("2017-06-13 
23:59:59"))
+assert(partitionInfo.getRangeIntervalInfo.get(2).equals("month"))
+  }
+
+  test("create partition table: range interval partition in week") {
+sql(
+  """
+| CREATE TABLE IF NOT EXISTS default.rangeIntervalWeekTable (empno 
int, empname String, designation String,
+|  workgroupcategory int, workgroupcategoryname String, deptno 
int, deptname String,
+|  projectcode int, projectjoindate Timestamp, projectenddate 
Timestamp,attendance int,
+|  utilization int,salary int)
+  

[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-07-09 Thread chenerlu
Github user chenerlu commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1103#discussion_r126324104
  
--- Diff: 
core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
 ---
@@ -47,6 +47,12 @@
*/
   private int numPartitions;
 
+  /**
+   * range interval information defined for range interval partition table
+   */
+  private List rangeIntervalInfo;
+
+
--- End diff --

Ok~


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] carbondata pull request #1103: [WIP] Implement range interval partition

2017-07-03 Thread mayunSaicmotor
Github user mayunSaicmotor commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/1103#discussion_r125289242
  
--- Diff: 
core/src/main/java/org/apache/carbondata/core/metadata/schema/PartitionInfo.java
 ---
@@ -47,6 +47,12 @@
*/
   private int numPartitions;
 
+  /**
+   * range interval information defined for range interval partition table
+   */
+  private List rangeIntervalInfo;
+
+
--- End diff --

maybe can remove unnecessary blank line 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---