carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ravipes...@apache.org
Subject [1/2] incubator-carbondata git commit: Range Filter Check Rectification
Date Thu, 27 Apr 2017 09:48:10 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 2acb310ec -> 53a0a0725


Range Filter Check Rectification

Modify ByteUtil Compare

Direct Dictionary test Case Addition


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

Branch: refs/heads/master
Commit: 105e3a0d7b58282f7228e4d6c96fd2dc97ef973f
Parents: 2acb310
Author: sounakr <sounakr@gmail.com>
Authored: Mon Apr 24 14:26:45 2017 +0530
Committer: ravipesala <ravi.pesala@gmail.com>
Committed: Thu Apr 27 15:16:57 2017 +0530

----------------------------------------------------------------------
 .../executer/RangeValueFilterExecuterImpl.java  |  43 ++-----
 .../apache/carbondata/core/util/ByteUtil.java   |  19 ++-
 .../src/test/resources/rangedatasample.csv      |  12 +-
 .../test/resources/rangenodictionarycompare.csv |  21 ++++
 .../RangeFilterAllDataTypesTestCases.scala      | 116 ++++++++++++++++++-
 .../detailquery/RangeFilterTestCase.scala       |  80 ++++++++++++-
 6 files changed, 245 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RangeValueFilterExecuterImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RangeValueFilterExecuterImpl.java
b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RangeValueFilterExecuterImpl.java
index 9dc6a99..a20f414 100644
--- a/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RangeValueFilterExecuterImpl.java
+++ b/core/src/main/java/org/apache/carbondata/core/scan/filter/executer/RangeValueFilterExecuterImpl.java
@@ -24,7 +24,6 @@ import org.apache.carbondata.core.constants.CarbonCommonConstants;
 import org.apache.carbondata.core.datastore.block.SegmentProperties;
 import org.apache.carbondata.core.datastore.chunk.DimensionColumnDataChunk;
 import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk;
-import org.apache.carbondata.core.datastore.chunk.impl.FixedLengthDimensionDataChunk;
 import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier;
 import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension;
 import org.apache.carbondata.core.scan.expression.Expression;
@@ -117,7 +116,7 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
    */
   private void ifDefaultValueMatchesFilter() {
     isDefaultValuePresentInFilter = false;
-    if (this.isDimensionPresentInCurrentBlock) {
+    if (!this.isDimensionPresentInCurrentBlock) {
       CarbonDimension dimension = this.dimColEvaluatorInfo.getDimension();
       byte[] defaultValue = dimension.getDefaultValue();
       if (null != defaultValue) {
@@ -354,8 +353,7 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
 
   private BitSet getFilteredIndexes(DimensionColumnDataChunk dimensionColumnDataChunk,
       int numerOfRows) {
-    if (dimensionColumnDataChunk.isExplicitSorted()
-        && dimensionColumnDataChunk instanceof FixedLengthDimensionDataChunk) {
+    if (dimensionColumnDataChunk.isExplicitSorted()) {
       return setFilterdIndexToBitSetWithColumnIndex(dimensionColumnDataChunk, numerOfRows);
     }
     return setFilterdIndexToBitSet(dimensionColumnDataChunk, numerOfRows);
@@ -401,13 +399,9 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
         // Method will compare the tentative index value after binary search, this tentative
         // index needs to be compared by the filter member if its >= filter then from
that
         // index the bitset will be considered for filtering process.
-        if ((greaterThanExp == true) && (ByteUtil.compare(filterValues[0], dimensionColumnDataChunk
+        if ((ByteUtil.compare(filterValues[0], dimensionColumnDataChunk
             .getChunkData(dimensionColumnDataChunk.getInvertedIndex(start)))) > 0) {
           start = start + 1;
-        } else if ((greaterThanEqualExp == true) && (ByteUtil.compare(filterValues[0],
-            dimensionColumnDataChunk
-                .getChunkData(dimensionColumnDataChunk.getInvertedIndex(start)))) >= 0)
{
-          start = start + 1;
         }
       }
 
@@ -421,6 +415,7 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
       start = CarbonUtil
           .getFirstIndexUsingBinarySearch(dimensionColumnDataChunk, startIndex, numerOfRows
- 1,
               filterValues[1], lessThanEqualExp);
+
       if (lessThanExp == true && start >= 0) {
         start =
             CarbonUtil.nextLesserValueToTarget(start, dimensionColumnDataChunk, filterValues[1]);
@@ -431,17 +426,12 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
         if (start == numerOfRows) {
           start = start - 1;
         }
-        // Method will compare the tentative index value after binary search, this tentative
-        // index needs to be compared by the filter member if its >= filter then from
that
-        // index the bitset will be considered for filtering process.
-        if ((lessThanExp == true) && (ByteUtil.compare(filterValues[1],
+        // In case the start is less than 0, then positive value of start is pointing to
the next
+        // value of the searched key. So move to the previous one.
+        if ((ByteUtil.compare(filterValues[1],
             dimensionColumnDataChunk.getChunkData(dimensionColumnDataChunk.getInvertedIndex(start)))
             < 0)) {
           start = start - 1;
-        } else if ((lessThanEqualExp == true) && (ByteUtil.compare(filterValues[1],
-            dimensionColumnDataChunk.getChunkData(dimensionColumnDataChunk.getInvertedIndex(start)))
-            <= 0)) {
-          start = start - 1;
         }
       }
       endMax = start;
@@ -511,14 +501,9 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
         // Method will compare the tentative index value after binary search, this tentative
         // index needs to be compared by the filter member if its >= filter then from
that
         // index the bitset will be considered for filtering process.
-        if ((greaterThanExp == true)
-            && (ByteUtil.compare(filterValues[0], dimensionColumnDataChunk.getChunkData(start)))
+        if ((ByteUtil.compare(filterValues[0], dimensionColumnDataChunk.getChunkData(start)))
             > 0) {
           start = start + 1;
-        } else if ((greaterThanEqualExp == true)
-            && (ByteUtil.compare(filterValues[0], dimensionColumnDataChunk.getChunkData(start)))
-            >= 0) {
-          start = start + 1;
         }
       }
       startMin = start;
@@ -541,14 +526,10 @@ public class RangeValueFilterExecuterImpl extends ValueBasedFilterExecuterImpl
{
         if (start == numerOfRows) {
           start = start - 1;
         }
-        // Method will compare the tentative index value after binary search, this tentative
-        // index needs to be compared by the filter member if its >= filter then from
that
-        // index the bitset will be considered for filtering process.
-        if ((lessThanExp == true) && (
-            ByteUtil.compare(filterValues[1], dimensionColumnDataChunk.getChunkData(start))
< 0)) {
-          start = start - 1;
-        } else if ((lessThanEqualExp == true) && (
-            ByteUtil.compare(filterValues[1], dimensionColumnDataChunk.getChunkData(start))
<= 0)) {
+        // In case the start is less than 0, then positive value of start is pointing to
the next
+        // value of the searched key. So move to the previous one.
+        if ((ByteUtil.compare(filterValues[1], dimensionColumnDataChunk.getChunkData(start))
+            < 0)) {
           start = start - 1;
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java b/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
index 7e7e01b..16c6760 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/ByteUtil.java
@@ -45,19 +45,16 @@ public final class ByteUtil {
     if (buffer1 == buffer2) {
       return 0;
     }
-    // Bring WritableComparator code local
-    int i = 0;
-    int j = 0;
-    for (; i < buffer1.length && j < buffer2.length; i++, j++) {
-      int a = (buffer1[i] & 0xff);
-      int b = (buffer2[j] & 0xff);
-      if (a != b) {
-        return a - b;
-      }
-    }
-    return 0;
+    int len1 = buffer1.length;
+    int len2 = buffer2.length;
+    int offset1 = 0;
+    int offset2 = 0;
+    // Call UnsafeComparer compareTo for comparision.
+    return ByteUtil.UnsafeComparer.INSTANCE
+        .compareTo(buffer1, offset1, len1, buffer2, offset2, len2);
   }
 
+
   /**
    * covert the long[] to int[]
    *

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/integration/spark-common-test/src/test/resources/rangedatasample.csv
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/resources/rangedatasample.csv b/integration/spark-common-test/src/test/resources/rangedatasample.csv
index b729470..263d26c 100644
--- a/integration/spark-common-test/src/test/resources/rangedatasample.csv
+++ b/integration/spark-common-test/src/test/resources/rangedatasample.csv
@@ -9,4 +9,14 @@ empno,doj,salary
 18,2016-03-14 15:00:16,1046
 19,2016-03-14 15:00:17,1047
 20,2016-03-14 15:00:18,1048
-21,,1040
+21,2016-03-14 15:00:20,5040
+22,2016-03-14 15:00:25,1040
+23,2016-03-14 15:00:31,1041
+24,2016-03-14 15:00:38,1042
+25,2016-03-14 15:00:39,1043
+26,2016-03-14 15:00:19,1044
+27,2016-03-14 15:00:49,1045
+28,2016-03-14 15:00:50,1046
+29,2016-03-14 15:00:24,1047
+30,2016-03-14 15:00:35,1048
+31,,1040

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/integration/spark-common-test/src/test/resources/rangenodictionarycompare.csv
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/resources/rangenodictionarycompare.csv
b/integration/spark-common-test/src/test/resources/rangenodictionarycompare.csv
new file mode 100644
index 0000000..1cd6c5c
--- /dev/null
+++ b/integration/spark-common-test/src/test/resources/rangenodictionarycompare.csv
@@ -0,0 +1,21 @@
+empno,empname,designation,doj,workgroupcategory,workgroupcategoryname,deptno,deptname,projectcode,projectjoindate,projectenddate,attendance,utilization,salary
+11,100,SE,17-01-2007,1,developer,10,network,928478,17-02-2007,29-11-2016,96,96,5040
+12,101,SSE,29-05-2008,1,developer,11,protocol,928378,29-06-2008,30-12-2016,85,95,7124
+13,108,TPL,07-07-2009,2,tester,10,network,928478,07-08-2009,30-12-2016,88,99,9054
+14,109,SA,29-12-2010,3,manager,11,protocol,928278,29-01-2011,29-06-2016,77,92,11248
+15,11111,SSA,09-11-2011,1,developer,12,security,928375,09-12-2011,29-05-2016,99,91,13245
+16,107,SE,14-10-2012,1,developer,13,configManagement,928478,14-11-2012,29-12-2016,86,93,5040
+17,1111119,PL,22-09-2013,2,tester,12,security,928778,22-10-2013,15-11-2016,78,97,9574
+18,1111118,TL,15-08-2014,2,tester,14,Learning,928176,15-09-2014,29-05-2016,84,98,7245
+19,131,PL,12-05-2015,1,developer,10,network,928977,12-06-2015,12-11-2016,88,91,11254
+20,129,PM,01-12-2015,3,manager,14,Learning,928479,01-01-2016,30-11-2016,75,94,13547
+21,124,SE,17-01-2007,1,developer,10,network,928478,17-02-2007,29-11-2016,96,96,5040
+22,106,SSE,29-05-2008,1,developer,11,protocol,928378,29-06-2008,30-12-2016,85,95,7124
+23,122222,TPL,07-07-2009,2,tester,10,network,928478,07-08-2009,30-12-2016,88,99,9054
+24,13333,SA,29-12-2010,3,manager,11,protocol,928278,29-01-2011,29-06-2016,77,92,11248
+25,140,SSA,09-11-2011,1,developer,12,security,928375,09-12-2011,29-05-2016,99,91,13245
+26,149,SE,14-10-2012,1,developer,13,configManagement,928478,14-11-2012,29-12-2016,86,93,5040
+27,132,PL,22-09-2013,2,tester,12,security,928778,22-10-2013,15-11-2016,78,97,9574
+28,13888888,TL,15-08-2014,2,tester,14,Learning,928176,15-09-2014,29-05-2016,84,98,7245
+29,126,PL,12-05-2015,1,developer,10,network,928977,12-06-2015,12-11-2016,88,91,11254
+30,116,PM,01-12-2015,3,manager,14,Learning,928479,01-01-2016,30-11-2016,75,94,13547

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterAllDataTypesTestCases.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterAllDataTypesTestCases.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterAllDataTypesTestCases.scala
index 5a72afe..68b08a3 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterAllDataTypesTestCases.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterAllDataTypesTestCases.scala
@@ -244,8 +244,7 @@ class RangeFilterMyTests extends QueryTest with BeforeAndAfterAll {
   test("test range filter for direct dictionary"){
     checkAnswer(
       sql("select doj from directDictionaryTable where doj > '2016-03-14 15:00:17'"),
-      Seq(Row(Timestamp.valueOf("2016-03-14 15:00:18.0"))
-      )
+      sql("select doj from directDictionaryTable_hive where doj > '2016-03-14 15:00:17'")
     )
   }
 
@@ -265,6 +264,36 @@ class RangeFilterMyTests extends QueryTest with BeforeAndAfterAll {
     )
   }
 
+  test("test range filter for direct dictionary and boundary 2"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:60.0'"),
+      sql("select count(*) from directDictionaryTable_hive where doj > '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:60.0'")
+    )
+  }
+
+
+  test("test range filter for direct dictionary and boundary 3"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj >= '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:60.0'"),
+      sql("select count(*) from directDictionaryTable_hive where doj >= '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:60.0'")
+    )
+  }
+
+
+  test("test range filter for direct dictionary and boundary 4"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:40.0'"),
+      sql("select count(*) from directDictionaryTable_hive where doj > '2016-03-14 15:00:23.0'
and doj < '2016-03-14 15:00:40.0'")
+    )
+  }
+
+  test("test range filter for direct dictionary and boundary 5"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > '2016-03-14 15:00:23.0'
and doj <= '2016-03-14 15:00:40.0'"),
+      sql("select count(*) from directDictionaryTable_hive where doj > '2016-03-14 15:00:23.0'
and doj <= '2016-03-14 15:00:40.0'")
+    )
+  }
+
   test("test range filter for direct dictionary more values after filter"){
     checkAnswer(
       sql("select doj from directDictionaryTable where doj > '2016-03-14 15:00:09'"),
@@ -293,6 +322,89 @@ class RangeFilterMyTests extends QueryTest with BeforeAndAfterAll {
     )
   }
 
+  // use cast for range
+  test("test range filter for direct dictionary cast"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast ('2016-03-14 15:00:17'
as timestamp)"),
+      sql("select doj from directDictionaryTable_hive where doj > cast ('2016-03-14 15:00:17'
as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary cast and"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast ('2016-03-14 15:00:16'
as timestamp) and doj < cast ('2016-03-14 15:00:18' as timestamp)"),
+      Seq(Row(Timestamp.valueOf("2016-03-14 15:00:17.0"))
+      )
+    )
+  }
+
+  test("test range filter for direct dictionary and boundary cast "){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > cast ('2016-03-14 15:00:18.0'
as timestamp) and doj < cast ('2016-03-14 15:00:09.0' as timestamp)"),
+      Seq(Row(0)
+      )
+    )
+  }
+
+  test("test range filter for direct dictionary and boundary 2 cast "){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > cast('2016-03-14 15:00:23.0'
as timestamp) and doj < cast ('2016-03-14 15:00:60.0' as timestamp)"),
+      sql("select count(*) from directDictionaryTable_hive where doj > cast('2016-03-14
15:00:23.0' as timestamp) and doj < cast ('2016-03-14 15:00:60.0' as timestamp)")
+    )
+  }
+
+
+  test("test range filter for direct dictionary and boundary 3 cast"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj >= cast('2016-03-14 15:00:23.0'
as timestamp) and doj < cast('2016-03-14 15:00:60.0' as timestamp)"),
+      sql("select count(*) from directDictionaryTable_hive where doj >= cast('2016-03-14
15:00:23.0' as timestamp) and doj < cast('2016-03-14 15:00:60.0' as timestamp)")
+    )
+  }
+
+
+  test("test range filter for direct dictionary and boundary 4 cast"){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > cast('2016-03-14 15:00:23.0'
as timestamp) and doj < cast('2016-03-14 15:00:40.0' as timestamp)"),
+      sql("select count(*) from directDictionaryTable_hive where doj > cast('2016-03-14
15:00:23.0' as timestamp) and doj < cast('2016-03-14 15:00:40.0' as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary and boundary 5 cast "){
+    checkAnswer(
+      sql("select count(*) from directDictionaryTable where doj > cast('2016-03-14 15:00:23.0'
as timestamp) and doj <= cast('2016-03-14 15:00:40.0' as timestamp)"),
+      sql("select count(*) from directDictionaryTable_hive where doj > cast('2016-03-14
15:00:23.0' as timestamp) and doj <= cast('2016-03-14 15:00:40.0' as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary more values after filter cast"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast('2016-03-14 15:00:09'
as timestamp)"),
+      sql("select doj from directDictionaryTable_hive where doj > cast('2016-03-14 15:00:09'
as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary or condition cast"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast('2016-03-14 15:00:09'
as timestamp) or doj > cast('2016-03-14 15:00:15' as timestamp)"),
+      sql("select doj from directDictionaryTable_hive where doj > cast('2016-03-14 15:00:09'
as timestamp) or doj > cast('2016-03-14 15:00:15' as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary or and condition cast"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast('2016-03-14 15:00:09'
as timestamp) or doj > cast('2016-03-14 15:00:15' as timestamp) and doj < cast('2016-03-14
15:00:13' as timestamp)"),
+      sql("select doj from directDictionaryTable_hive where doj > cast('2016-03-14 15:00:09'
as timestamp) or doj > cast('2016-03-14 15:00:15' as timestamp) and doj < cast('2016-03-14
15:00:13' as timestamp)")
+    )
+  }
+
+  test("test range filter for direct dictionary with no data in csv cast"){
+    checkAnswer(
+      sql("select doj from directDictionaryTable where doj > cast('2016-03-14 15:05:09'
as timestamp) or doj > cast('2016-03-14 15:05:15' as timestamp) and doj < cast('2016-03-14
15:50:13' as timestamp)"),
+      sql("select doj from directDictionaryTable_hive where doj > cast('2016-03-14 15:05:09'
as timestamp) or doj > cast('2016-03-14 15:05:15' as timestamp) and doj < cast('2016-03-14
15:50:13' as timestamp)")
+    )
+  }
+
+
   test("test range filter for measure in dictionary include"){
     checkAnswer(
       sql("select empno,empname,workgroupcategory from NO_DICTIONARY_CARBON_6 where deptno
> 10 "),

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/105e3a0d/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterTestCase.scala
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterTestCase.scala
index 89b4db9..3dd01cc 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterTestCase.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/detailquery/RangeFilterTestCase.scala
@@ -40,6 +40,7 @@ class RangeFilterTestCase extends QueryTest with BeforeAndAfterAll {
     sql("drop table if exists NO_DICTIONARY_CARBON_6")
     sql("drop table if exists DICTIONARY_CARBON_6")
     sql("drop table if exists NO_DICTIONARY_CARBON_7")
+    sql("drop table if exists NO_DICTIONARY_HIVE_8")
 
     sql("CREATE TABLE NO_DICTIONARY_HIVE_1 (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION
" +
         "string, DOB timestamp, DOJ timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,"
+
@@ -117,9 +118,25 @@ class RangeFilterTestCase extends QueryTest with BeforeAndAfterAll {
         "TBLPROPERTIES('DICTIONARY_EXCLUDE'='empno,empname,designation')"
     )
     sql(
-      s"LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE NO_DICTIONARY_CARBON_7
" +
+      s"LOAD DATA LOCAL INPATH '$resourcesPath/rangenodictionarycompare.csv' INTO TABLE NO_DICTIONARY_CARBON_7
" +
       "OPTIONS('DELIMITER'= ',', 'QUOTECHAR'= '\"')"
     )
+
+    sql(
+      "create table NO_DICTIONARY_HIVE_8(empno string,empname string,designation string,doj
" +
+      "Timestamp,workgroupcategory int, " +
+      "workgroupcategoryname string,deptno int, deptname string, projectcode int, " +
+      "projectjoindate Timestamp,projectenddate Timestamp,attendance int, "
+      + "utilization int,salary int) row format delimited fields terminated by ',' " +
+      "tblproperties(\"skip.header.line.count\"=\"1\") " +
+      ""
+    )
+
+    sql(
+      s"load data local inpath '$resourcesPath/rangenodictionarycompare.csv' into table "
+
+      "NO_DICTIONARY_HIVE_8"
+    );
+
     sql("CREATE TABLE filtertestTable (ID string,date Timestamp, country String, " +
         "name String, phonetype String, serialname String, salary Int) " +
         "STORED BY 'org.apache.carbondata.format' " +  "TBLPROPERTIES('DICTIONARY_EXCLUDE'='ID')"
@@ -429,6 +446,67 @@ class RangeFilterTestCase extends QueryTest with BeforeAndAfterAll {
       sql("select s.empno, s.empname, t.empno, t.empname from NO_DICTIONARY_HIVE_6 s, NO_DICTIONARY_HIVE_7
t where s.empno > '09' and t.empno < '30' and s.empname = t.empname"))
   }
 
+  test("Range with name comparision") {
+   checkAnswer(
+    sql("select empname from NO_DICTIONARY_CARBON_7 where empname >= '11' and empname
< '12'"),
+    sql("select empname from NO_DICTIONARY_HIVE_8 where empname >= '11' and empname <
'12'"))
+  }
+
+  test("Range with name comparision 1") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname > '10' and empname
< '11'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname > '10' and empname <
'11'"))
+  }
+
+  test("Range with name comparision 3") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname > '10' and empname
<= '11'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname > '10' and empname <=
'11'"))
+  }
+
+
+  test("Range with name comparision 4") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname >= '10' and empno
<= '11'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname >= '10' and empno <=
'11'"))
+  }
+
+  test("Range with name comparision 5") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname >= '09' and empno
<= '50'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname >= '09' and empno <=
'50'"))
+  }
+
+  test("Range with name comparision 6") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname >= '03' and empno
<= '09'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname >= '03' and empno <=
'09'"))
+  }
+
+  test("Range with name comparision 7") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname >= '10' and empno
<= '50'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname >= '10' and empno <=
'50'"))
+  }
+
+  test("Range with name comparision 8") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname > '10' and empno <=
'50'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname > '10' and empno <=
'50'"))
+  }
+
+  test("Range with name comparision 9") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname > '10' and empno <=
'13'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname > '10' and empno <=
'13'"))
+  }
+
+  test("Range with name comparision 10") {
+    checkAnswer(
+      sql("select empname from NO_DICTIONARY_CARBON_7 where empname > '10' and empno <=
'14'"),
+      sql("select empname from NO_DICTIONARY_HIVE_8 where empname > '10' and empno <=
'14'"))
+  }
+
 
   override def afterAll {
     sql("drop table if exists filtertestTable")


Mime
View raw message