You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/03/14 21:31:40 UTC

[2/5] impala git commit: IMPALA-6635: Add DECIMAL type to Kudu predicates

IMPALA-6635: Add DECIMAL type to Kudu predicates

This patch enables pushing scan predicates on
DECIMAL columns down to Kudu.

Testing:
- Added Planner decimal predicate test to kudu.test
- Added Planner decimal in-list test to kudu-selectivity.test

Change-Id: I2569a9e1d58f1c58884d58633d46348364888ed7
Reviewed-on: http://gerrit.cloudera.org:8080/9578
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/35d1d9c8
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/35d1d9c8
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/35d1d9c8

Branch: refs/heads/2.x
Commit: 35d1d9c863cad9eb19f06704f36a52b2f9ecfa5a
Parents: 6d3fdee
Author: Grant Henke <gh...@cloudera.com>
Authored: Fri Mar 9 15:12:43 2018 -0600
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Wed Mar 14 00:54:33 2018 +0000

----------------------------------------------------------------------
 .../java/org/apache/impala/planner/KuduScanNode.java |  6 ++++++
 .../queries/PlannerTest/kudu-selectivity.test        | 14 ++++++++++++++
 .../functional-planner/queries/PlannerTest/kudu.test | 15 +++++++++++++++
 3 files changed, 35 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/35d1d9c8/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
index a02b49b..f60d519 100644
--- a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
@@ -406,6 +406,11 @@ public class KuduScanNode extends ScanNode {
         }
         break;
       }
+      case DECIMAL: {
+        kuduPredicate = KuduPredicate.newComparisonPredicate(column, op,
+            ((NumericLiteral)literal).getValue());
+        break;
+      }
       default: break;
     }
     if (kuduPredicate == null) return false;
@@ -505,6 +510,7 @@ public class KuduScanNode extends ScanNode {
         }
         break;
       }
+      case DECIMAL: return ((NumericLiteral) e).getValue();
       default:
         Preconditions.checkState(false,
             "Unsupported Kudu type considered for predicate: %s", e.getType().toSql());

http://git-wip-us.apache.org/repos/asf/impala/blob/35d1d9c8/testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test b/testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test
index e6c8422..cf3014f 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/kudu-selectivity.test
@@ -121,6 +121,7 @@ Per-Host Resources: mem-estimate=0B mem-reservation=0B
      mem-estimate=0B mem-reservation=0B
      tuple-ids=0 row-size=124B cardinality=3
 ====
+# Test alltypes in-list predicates.
 select * from functional_kudu.alltypes where
 -- predicates that can be pushed
 tinyint_col in (1, 2) and
@@ -156,6 +157,19 @@ Per-Host Resources: mem-estimate=0B mem-reservation=0B
      mem-estimate=0B mem-reservation=0B
      tuple-ids=0 row-size=97B cardinality=5
 ====
+# Test decimal in-list predicates.
+select * from functional_kudu.decimal_tbl where d1 in (1234, 12345);
+---- PLAN
+F00:PLAN FRAGMENT [UNPARTITIONED] hosts=1 instances=1
+Per-Host Resources: mem-estimate=0B mem-reservation=0B
+  PLAN-ROOT SINK
+  |  mem-estimate=0B mem-reservation=0B
+  |
+  00:SCAN KUDU [functional_kudu.decimal_tbl]
+     kudu predicates: d1 IN (1234, 12345)
+     mem-estimate=0B mem-reservation=0B
+     tuple-ids=0 row-size=56B cardinality=2
+====
 select * from functional_kudu.alltypes where
 tinyint_col is not null and
 smallint_col is null and

http://git-wip-us.apache.org/repos/asf/impala/blob/35d1d9c8/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
index d506ae7..e67911d 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
@@ -540,3 +540,18 @@ INSERT INTO KUDU [functional_kudu.jointbl]
 00:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
 ====
+# Decimal predicate.
+select * from functional_kudu.decimal_tbl where d4 = 0.123456789;
+---- PLAN
+PLAN-ROOT SINK
+|
+00:SCAN KUDU [functional_kudu.decimal_tbl]
+   kudu predicates: d4 = 0.123456789
+---- DISTRIBUTEDPLAN
+PLAN-ROOT SINK
+|
+01:EXCHANGE [UNPARTITIONED]
+|
+00:SCAN KUDU [functional_kudu.decimal_tbl]
+   kudu predicates: d4 = 0.123456789
+====
\ No newline at end of file