Skip to content

Commit

Permalink
[CARBONDATA-2552]Fix Data Mismatch for Complex Data type Array of Tim…
Browse files Browse the repository at this point in the history
…estamp with Dictionary Include

Fix Data Mismatch for Complex Data type Array and Struct of Timestamp with Dictionary Include
  • Loading branch information
Indhumathi27 authored and kumarvishal09 committed May 29, 2018
1 parent 8896a63 commit 2993034
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public PrimitiveQueryType(String name, String parentname, int blockIndex,
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, "+
Expand Down

0 comments on commit 2993034

Please sign in to comment.