Skip to content

Commit

Permalink
Merge 7cd1849 into 7f05e69
Browse files Browse the repository at this point in the history
  • Loading branch information
kunal642 committed Apr 4, 2019
2 parents 7f05e69 + 7cd1849 commit 0fcae03
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ public int compareTo(int rowId, byte[] compareValue) {
// if the compare value is null and the data is also null we can directly return 0
return 0;
} else {
byte[] chunkData = this.getChunkDataInBytes(rowId);
byte[] chunkData;
if (nullBitSet != null && nullBitSet.length == 0) {
chunkData = nullBitSet;
} else {
chunkData = this.getChunkDataInBytes(rowId);
}
return ByteUtil.UnsafeComparer.INSTANCE.compareTo(chunkData, compareValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,36 @@ class TestSortColumns extends QueryTest with BeforeAndAfterAll {
"sort_columns is unsupported for double datatype column: empno"))
}

test("test if equal to 0 filter on sort column gives correct result") {
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION,
"FORCE")
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_PUSH_ROW_FILTERS_FOR_VECTOR,
"true")
sql("create table test1(a bigint) stored by 'carbondata' TBLPROPERTIES('sort_columns'='a')")
sql("insert into test1 select 'k'")
sql("insert into test1 select '1'")
assert(sql("select * from test1 where a = 1 or a = 0").count() == 1)
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION,
CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION_DEFAULT)
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_PUSH_ROW_FILTERS_FOR_VECTOR,
CarbonCommonConstants.CARBON_PUSH_ROW_FILTERS_FOR_VECTOR_DEFAULT)
}

override def afterAll = {
dropTestTables
CarbonProperties.getInstance().addProperty(
CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, CarbonCommonConstants.CARBON_TIMESTAMP_DEFAULT_FORMAT)
CarbonProperties.getInstance()
.addProperty(CarbonCommonConstants.LOAD_SORT_SCOPE,
CarbonCommonConstants.LOAD_SORT_SCOPE_DEFAULT)
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION,
CarbonCommonConstants.CARBON_BAD_RECORDS_ACTION_DEFAULT)
CarbonProperties.getInstance().addProperty(CarbonCommonConstants.CARBON_PUSH_ROW_FILTERS_FOR_VECTOR,
CarbonCommonConstants.CARBON_PUSH_ROW_FILTERS_FOR_VECTOR_DEFAULT)
}

def dropTestTables = {
sql("drop table if exists test1")
sql("drop table if exists sortint")
sql("drop table if exists sortint1")
sql("drop table if exists sortlong")
Expand Down

0 comments on commit 0fcae03

Please sign in to comment.