Repository: carbondata
Updated Branches:
  refs/heads/master 8896a6334 -> 2993034e8


[CARBONDATA-2552]Fix Data Mismatch for Complex Data type Array of Timestamp 
with Dictionary Include

Fix Data Mismatch for Complex Data type Array and Struct of Timestamp with 
Dictionary Include


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

Branch: refs/heads/master
Commit: 2993034e8b4435cf506bd03c73416236b6fb2106
Parents: 8896a63
Author: Indhumathi27 <[email protected]>
Authored: Mon May 28 22:17:36 2018 +0530
Committer: kumarvishal09 <[email protected]>
Committed: Tue May 29 17:20:36 2018 +0530

----------------------------------------------------------------------
 .../core/scan/complextypes/PrimitiveQueryType.java  |  2 +-
 .../TestLoadDataWithHiveSyntaxDefaultFormat.scala   | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/2993034e/core/src/main/java/org/apache/carbondata/core/scan/complextypes/PrimitiveQueryType.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/scan/complextypes/PrimitiveQueryType.java
 
b/core/src/main/java/org/apache/carbondata/core/scan/complextypes/PrimitiveQueryType.java
index 899957e..d7723b3 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/scan/complextypes/PrimitiveQueryType.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/scan/complextypes/PrimitiveQueryType.java
@@ -95,7 +95,7 @@ public class PrimitiveQueryType extends ComplexQueryType 
implements GenericQuery
       DimensionRawColumnChunk[] rawColumnChunks, int rowNumber,
       int pageNumber, DataOutputStream dataOutputStream) throws IOException {
     byte[] currentVal = copyBlockDataChunk(rawColumnChunks, rowNumber, 
pageNumber);
-    if (!this.isDictionary) {
+    if (!this.isDictionary && !this.isDirectDictionary) {
       dataOutputStream.writeShort(currentVal.length);
     }
     dataOutputStream.write(currentVal);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/2993034e/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
index d0d578d..7f150be 100644
--- 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
+++ 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestLoadDataWithHiveSyntaxDefaultFormat.scala
@@ -365,6 +365,22 @@ class TestLoadDataWithHiveSyntaxDefaultFormat extends 
QueryTest with BeforeAndAf
     sql("drop table if exists complexcarbontable")
   }
 
+  test("test Complex Data type - Array and Struct of timestamp with dictionary 
include") {
+    sql("DROP TABLE IF EXISTS array_timestamp")
+    sql(
+      "create table array_timestamp (date1 array<timestamp>,date2 
struct<date:timestamp> ) stored" +
+      " by 'carbondata' tblproperties" +
+      "('dictionary_include'='date1,date2')")
+    CarbonProperties.getInstance()
+      .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd")
+    sql("insert into array_timestamp 
values('2015/01/01$2016/01/01','2017/01/01')")
+    checkExistence(sql("select * from array_timestamp "),
+      true, "2015-01-01 00:00:00.0, 2016-01-01 00:00:00.0")
+    checkExistence(sql("select * from array_timestamp "),
+      true, "2017-01-01 00:00:00.0")
+    sql("DROP TABLE IF EXISTS array_timestamp")
+  }
+
   test("array<string> and string datatype for same column is not working 
properly") {
     sql("drop table if exists complexcarbontable")
     sql("create table complexcarbontable(deviceInformationId int, MAC 
array<string>, channelsId string, "+

Reply via email to