impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [2/3] incubator-impala git commit: IMPALA-1788: Fold constant expressions.
Date Wed, 23 Nov 2016 21:53:17 GMT
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
----------------------------------------------------------------------
diff --git a/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java b/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
index 16ca7e2..f1b5195 100644
--- a/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java
@@ -26,6 +26,7 @@ import org.apache.impala.rewrite.BetweenToCompoundRule;
 import org.apache.impala.rewrite.ExprRewriteRule;
 import org.apache.impala.rewrite.ExprRewriter;
 import org.apache.impala.rewrite.ExtractCommonConjunctRule;
+import org.apache.impala.rewrite.FoldConstantsRule;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -38,7 +39,8 @@ public class ExprRewriteRulesTest extends FrontendTestBase {
 
   public Expr RewritesOk(String expr, ExprRewriteRule rule, String expectedExpr)
       throws AnalysisException {
-    String stmtStr = "select " + expr + " from functional.alltypes";
+    System.out.println(expr);
+    String stmtStr = "select " + expr + " from functional.alltypessmall";
     SelectStmt stmt = (SelectStmt) ParsesOk(stmtStr);
     Analyzer analyzer = createAnalyzer(Catalog.DEFAULT_DB);
     stmt.analyze(analyzer);
@@ -198,4 +200,33 @@ public class ExprRewriteRulesTest extends FrontendTestBase {
         "int_col < 10 AND " +
         "((bigint_col < 10) OR (string_col = '10') OR (id < 20) OR (id < 20))");
   }
+
+  /**
+   * Only contains very basic tests for a few interesting cases. More thorough
+   * testing is done in expr-test.cc.
+   */
+  @Test
+  public void TestFoldConstantsRule() throws AnalysisException {
+    ExprRewriteRule rule = FoldConstantsRule.INSTANCE;
+
+    RewritesOk("1 + 1", rule, "2");
+    RewritesOk("1 + 1 + 1 + 1 + 1", rule, "5");
+    RewritesOk("10 - 5 - 2 - 1 - 8", rule, "-6");
+    RewritesOk("cast('2016-11-09' as timestamp)", rule,
+        "TIMESTAMP '2016-11-09 00:00:00'");
+    RewritesOk("cast('2016-11-09' as timestamp) + interval 1 year", rule,
+        "TIMESTAMP '2017-11-09 00:00:00'");
+
+    // Tests correct handling of strings with escape sequences.
+    RewritesOk("'_' LIKE '\\\\_'", rule, "TRUE");
+    RewritesOk("base64decode(base64encode('\\047\\001\\132\\060')) = " +
+      "'\\047\\001\\132\\060'", rule, "TRUE");
+
+    // Tests correct handling of strings with chars > 127. Should not be folded.
+    RewritesOk("hex(unhex(hex(unhex('D3'))))", rule, null);
+    // Tests that non-deterministic functions are not folded.
+    RewritesOk("rand()", rule, null);
+    // Tests that exprs that warn during their evaluation are not folded.
+    RewritesOk("coalesce(1.8, cast(int_col as decimal(38,38)))", rule, null);
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
----------------------------------------------------------------------
diff --git a/fe/src/test/java/org/apache/impala/planner/PlannerTest.java b/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
index 91035d1..dce32a6 100644
--- a/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
+++ b/fe/src/test/java/org/apache/impala/planner/PlannerTest.java
@@ -39,6 +39,14 @@ public class PlannerTest extends PlannerTestBase {
   }
 
   @Test
+  public void testConstantFolding() {
+    // Tests that constant folding is applied to all relevant PlanNodes and DataSinks.
+    // Note that not all Exprs are printed in the explain plan, so validating those
+    // via this test is currently not possible.
+    runPlannerTestFile("constant-folding");
+  }
+
+  @Test
   public void testEmpty() {
     runPlannerTestFile("empty");
   }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/fe/src/test/java/org/apache/impala/testutil/TestUtils.java
----------------------------------------------------------------------
diff --git a/fe/src/test/java/org/apache/impala/testutil/TestUtils.java b/fe/src/test/java/org/apache/impala/testutil/TestUtils.java
index fd07971..c958940 100644
--- a/fe/src/test/java/org/apache/impala/testutil/TestUtils.java
+++ b/fe/src/test/java/org/apache/impala/testutil/TestUtils.java
@@ -32,10 +32,6 @@ import javax.json.JsonWriter;
 import javax.json.JsonWriterFactory;
 import javax.json.stream.JsonGenerator;
 
-import org.junit.Assume;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import org.apache.impala.catalog.Catalog;
 import org.apache.impala.common.RuntimeEnv;
 import org.apache.impala.thrift.TClientRequest;
@@ -45,6 +41,10 @@ import org.apache.impala.thrift.TQueryOptions;
 import org.apache.impala.thrift.TSessionState;
 import org.apache.impala.thrift.TSessionType;
 import org.apache.impala.thrift.TUniqueId;
+import org.junit.Assume;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import com.google.common.collect.Maps;
 
 public class TestUtils {
@@ -247,6 +247,8 @@ public class TestUtils {
 
   /**
    * Create a TQueryCtx for executing FE tests using the given default DB and user.
+   * Expr rewrites are disabled by default and should be enabled by the caller
+   * if so desired.
    */
   public static TQueryCtx createQueryContext(String defaultDb, String user) {
     TQueryCtx queryCtx = new TQueryCtx();
@@ -258,6 +260,9 @@ public class TestUtils {
     queryCtx.setNow_string(formatter.format(Calendar.getInstance().getTime()));
     queryCtx.setStart_unix_millis(System.currentTimeMillis());
     queryCtx.setPid(1000);
+    // Disable rewrites by default because some analyzer tests have non-executable
+    // constant exprs (e.g. dummy UDFs) that do not work with constant folding.
+    queryCtx.request.query_options.setEnable_expr_rewrites(false);
     return queryCtx;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test b/testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test
index d7838f9..b4fe75b 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/aggregation.test
@@ -709,7 +709,7 @@ PLAN-ROOT SINK
 |
 01:AGGREGATE [FINALIZE]
 |  output: count(*)
-|  group by: bool_col, CAST(NULL AS INT)
+|  group by: bool_col, NULL
 |
 00:SCAN HDFS [functional.alltypestiny]
    partitions=4/4 files=4 size=460B
@@ -1037,12 +1037,12 @@ PLAN-ROOT SINK
 |--05:EXCHANGE [HASH(o_custkey)]
 |  |
 |  01:SCAN HDFS [tpch_parquet.orders]
-|     partitions=1/1 files=2 size=54.93MB
+|     partitions=1/1 files=2 size=54.00MB
 |
 04:EXCHANGE [HASH(c_custkey)]
 |
 00:SCAN HDFS [tpch_parquet.customer]
-   partitions=1/1 files=1 size=12.47MB
+   partitions=1/1 files=1 size=12.27MB
    predicates: c_nationkey = 16
    runtime filters: RF000 -> c_custkey
 ====
@@ -1077,12 +1077,12 @@ PLAN-ROOT SINK
 |--06:EXCHANGE [HASH(c_custkey)]
 |  |
 |  01:SCAN HDFS [tpch_parquet.customer]
-|     partitions=1/1 files=1 size=12.47MB
+|     partitions=1/1 files=1 size=12.27MB
 |
 05:EXCHANGE [HASH(o_custkey)]
 |
 00:SCAN HDFS [tpch_parquet.orders]
-   partitions=1/1 files=2 size=54.93MB
+   partitions=1/1 files=2 size=54.00MB
    runtime filters: RF000 -> o_custkey
 ====
 # Distinct grouping aggregation where input is partitioned on distinct and grouping exprs.
@@ -1110,12 +1110,12 @@ PLAN-ROOT SINK
 |--06:EXCHANGE [HASH(c_custkey)]
 |  |
 |  01:SCAN HDFS [tpch_parquet.customer]
-|     partitions=1/1 files=1 size=12.47MB
+|     partitions=1/1 files=1 size=12.27MB
 |
 05:EXCHANGE [HASH(o_custkey)]
 |
 00:SCAN HDFS [tpch_parquet.orders]
-   partitions=1/1 files=2 size=54.93MB
+   partitions=1/1 files=2 size=54.00MB
    runtime filters: RF000 -> o_custkey
 ====
 # Complex aggregation when two joins and an agg end up in same fragment.
@@ -1149,7 +1149,7 @@ PLAN-ROOT SINK
 |--08:EXCHANGE [BROADCAST]
 |  |
 |  02:SCAN HDFS [tpch_parquet.customer]
-|     partitions=1/1 files=1 size=12.47MB
+|     partitions=1/1 files=1 size=12.27MB
 |
 03:HASH JOIN [INNER JOIN, PARTITIONED]
 |  hash predicates: l_orderkey = o_orderkey, l_returnflag = o_clerk
@@ -1158,12 +1158,12 @@ PLAN-ROOT SINK
 |--07:EXCHANGE [HASH(o_orderkey,o_clerk)]
 |  |
 |  01:SCAN HDFS [tpch_parquet.orders]
-|     partitions=1/1 files=2 size=54.93MB
+|     partitions=1/1 files=2 size=54.00MB
 |     runtime filters: RF000 -> o_custkey, RF001 -> o_comment
 |
 06:EXCHANGE [HASH(l_orderkey,l_returnflag)]
 |
 00:SCAN HDFS [tpch_parquet.lineitem]
-   partitions=1/1 files=3 size=195.85MB
+   partitions=1/1 files=3 size=193.61MB
    runtime filters: RF002 -> l_orderkey, RF003 -> l_returnflag
-====
\ No newline at end of file
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test b/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
index 9f97d62..af45129 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/conjunct-ordering.test
@@ -89,7 +89,7 @@ PLAN-ROOT SINK
 |
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
-   predicates: a.int_col = 0, a.timestamp_col > '2000-01-01'
+   predicates: a.int_col = 0, a.timestamp_col > TIMESTAMP '2000-01-01 00:00:00'
 ====
 # Check that string comparisons are ordered by string length.
 select *
@@ -114,7 +114,7 @@ PLAN-ROOT SINK
 |
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
-   predicates: a.timestamp_col < '2020-01-01', a.timestamp_col - INTERVAL 1 day > '2000-01-01'
+   predicates: a.timestamp_col < TIMESTAMP '2020-01-01 00:00:00', a.timestamp_col - INTERVAL 1 day > TIMESTAMP '2000-01-01 00:00:00'
 ====
 # Check that a function call adds cost.
 select *

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/constant-folding.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/constant-folding.test b/testdata/workloads/functional-planner/queries/PlannerTest/constant-folding.test
new file mode 100644
index 0000000..d76bffa
--- /dev/null
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/constant-folding.test
@@ -0,0 +1,209 @@
+# Test HDFS scan node.
+select 1
+from tpch_nested_parquet.customer c, c.c_orders o, o.o_lineitems
+where 5 + 5 < c_custkey and o_orderkey = (2 + 2)
+  and (coalesce(2, 3, 4) * 10) + l_linenumber < (0 * 1)
+---- PLAN
+PLAN-ROOT SINK
+|
+01:SUBPLAN
+|
+|--08:NESTED LOOP JOIN [CROSS JOIN]
+|  |
+|  |--02:SINGULAR ROW SRC
+|  |
+|  04:SUBPLAN
+|  |
+|  |--07:NESTED LOOP JOIN [CROSS JOIN]
+|  |  |
+|  |  |--05:SINGULAR ROW SRC
+|  |  |
+|  |  06:UNNEST [o.o_lineitems]
+|  |
+|  03:UNNEST [c.c_orders o]
+|
+00:SCAN HDFS [tpch_nested_parquet.customer c]
+   partitions=1/1 files=4 size=577.87MB
+   predicates: 10 < c_custkey, !empty(c.c_orders)
+   predicates on o: !empty(o.o_lineitems), o_orderkey = 4
+   predicates on o_lineitems: 20 + l_linenumber < 0
+====
+# Test HBase scan node.
+select * from functional_hbase.stringids
+where string_col = cast(4 as string) and 2 + 3 = tinyint_col
+  and id between concat('1', '0') and upper('20')
+---- PLAN
+PLAN-ROOT SINK
+|
+00:SCAN HBASE [functional_hbase.stringids]
+   start key: 10
+   stop key: 20\0
+   hbase filters: d:string_col EQUAL '4'
+   predicates: 5 = tinyint_col, string_col = '4'
+====
+# Test datasource scan node.
+select * from functional.alltypes_datasource
+where tinyint_col < (pow(2, 8)) and float_col != 0 and 1 + 1 > int_col
+---- PLAN
+PLAN-ROOT SINK
+|
+00:SCAN DATA SOURCE [functional.alltypes_datasource]
+data source predicates: tinyint_col < 256, 2 > int_col
+predicates: float_col != 0
+====
+# Test aggregation.
+select sum(1 + 1 + id)
+from functional.alltypes
+group by timestamp_col = cast('2015-11-15' as timestamp) + interval 1 year
+having 1024 * 1024 * count(*) % 2 = 0
+---- PLAN
+PLAN-ROOT SINK
+|
+01:AGGREGATE [FINALIZE]
+|  output: sum(2 + id), count(*)
+|  group by: timestamp_col = TIMESTAMP '2016-11-15 00:00:00'
+|  having: 1048576 * count(*) % 2 = 0
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test hash join.
+select 1 from functional.alltypes a
+left outer join functional.alltypes b
+  on (1 + 1 + a.id = b.id - (1 + 1) and
+      a.int_col between 0 + 0 + 0 + b.bigint_col and b.bigint_col + ascii('a'))
+where round(1.11 + 2.22 + 3.33 + 4.44, 1) < cast(b.double_col as decimal(3, 2))
+---- PLAN
+PLAN-ROOT SINK
+|
+02:HASH JOIN [LEFT OUTER JOIN]
+|  hash predicates: 2 + a.id = b.id - 2
+|  other join predicates: a.int_col <= b.bigint_col + 97, a.int_col >= 0 + b.bigint_col
+|  other predicates: 11.1 < CAST(b.double_col AS DECIMAL(3,2))
+|
+|--01:SCAN HDFS [functional.alltypes b]
+|     partitions=24/24 files=24 size=478.45KB
+|     predicates: 11.1 < CAST(b.double_col AS DECIMAL(3,2))
+|
+00:SCAN HDFS [functional.alltypes a]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test nested-loop join. Same as above but and with a disjunction in the On clause.
+# The Where-clause predicate has the lhs/rhs flipped.
+select 1 from functional.alltypes a
+left outer join functional.alltypes b
+  on (1 + 1 + a.id = b.id - (1 + 1) or
+      a.int_col between 0 + 0 + 0 + b.bigint_col and b.bigint_col + ascii('a'))
+where cast(b.double_col as decimal(3, 2)) > round(1.11 + 2.22 + 3.33 + 4.44, 1)
+---- PLAN
+PLAN-ROOT SINK
+|
+02:NESTED LOOP JOIN [LEFT OUTER JOIN]
+|  join predicates: (2 + a.id = b.id - 2 OR a.int_col >= 0 + b.bigint_col AND a.int_col <= b.bigint_col + 97)
+|  predicates: CAST(b.double_col AS DECIMAL(3,2)) > 11.1
+|
+|--01:SCAN HDFS [functional.alltypes b]
+|     partitions=24/24 files=24 size=478.45KB
+|     predicates: CAST(b.double_col AS DECIMAL(3,2)) > 11.1
+|
+00:SCAN HDFS [functional.alltypes a]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test distinct aggregation with grouping.
+select sum(distinct 1 + 1 + id)
+from functional.alltypes
+group by timestamp_col = cast('2015-11-15' as timestamp) + interval 1 year
+having 1024 * 1024 * count(*) % 2 = 0
+---- PLAN
+PLAN-ROOT SINK
+|
+02:AGGREGATE [FINALIZE]
+|  output: sum(2 + id), count:merge(*)
+|  group by: timestamp_col = TIMESTAMP '2016-11-15 00:00:00'
+|  having: 1048576 * count(*) % 2 = 0
+|
+01:AGGREGATE
+|  output: count(*)
+|  group by: timestamp_col = TIMESTAMP '2016-11-15 00:00:00', 2 + id
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test non-grouping distinct aggregation.
+select sum(distinct 1 + 1 + id)
+from functional.alltypes
+having 1024 * 1024 * count(*) % 2 = 0
+---- PLAN
+PLAN-ROOT SINK
+|
+02:AGGREGATE [FINALIZE]
+|  output: sum(2 + id), count:merge(*)
+|  having: 1048576 * zeroifnull(count(*)) % 2 = 0
+|
+01:AGGREGATE
+|  output: count(*)
+|  group by: 2 + id
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test analytic eval node.
+select first_value(1 + 1 + int_col - (1 - 1)) over
+  (partition by concat(concat('a', 'b'), string_col)
+   order by greatest(greatest(10, 20), bigint_col))
+from functional.alltypes
+---- PLAN
+PLAN-ROOT SINK
+|
+02:ANALYTIC
+|  functions: first_value(2 + int_col - 0)
+|  partition by: concat('ab', string_col)
+|  order by: greatest(20, bigint_col) ASC
+|  window: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+|
+01:SORT
+|  order by: concat('ab', string_col) ASC NULLS FIRST, greatest(20, bigint_col) ASC
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test sort node.
+select int_col from functional.alltypes
+order by id * abs((factorial(5) / power(2, 4)))
+---- PLAN
+PLAN-ROOT SINK
+|
+01:SORT
+|  order by: id * 7.5 ASC
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+====
+# Test HDFS table sink.
+insert into functional.alltypes (id, int_col) partition(year,month)
+select id, int_col, cast(1 + 1 + 1 + year as int), cast(month - (1 - 1 - 1) as int)
+from functional.alltypessmall
+---- PLAN
+WRITE TO HDFS [functional.alltypes, OVERWRITE=false, PARTITION-KEYS=(CAST(3 + year AS INT),CAST(month - -1 AS INT))]
+|  partitions=4
+|
+00:SCAN HDFS [functional.alltypessmall]
+   partitions=4/4 files=4 size=6.32KB
+====
+# Constant folding does not work across query blocks.
+select sum(id + c3) from
+  (select id, 10 + c2 as c3 from
+    (select id, 20 + c1 as c2 from
+      (select id, 30 as c1 from functional.alltypes limit 2) v1
+    ) v2
+  ) v3
+---- PLAN
+PLAN-ROOT SINK
+|
+01:AGGREGATE [FINALIZE]
+|  output: sum(id + 10 + 20 + 30)
+|
+00:SCAN HDFS [functional.alltypes]
+   partitions=24/24 files=24 size=478.45KB
+   limit: 2
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/empty.test b/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
index 7933b3a..014a1ea 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/empty.test
@@ -149,7 +149,7 @@ PLAN-ROOT SINK
 |
 02:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: a.id = b.id
-|  other join predicates: 1 + 1 > 10
+|  other join predicates: FALSE
 |
 |--01:SCAN HDFS [functional.alltypestiny b]
 |     partitions=4/4 files=4 size=460B
@@ -168,7 +168,7 @@ PLAN-ROOT SINK
 |
 02:HASH JOIN [RIGHT OUTER JOIN]
 |  hash predicates: a.id = b.id
-|  other join predicates: NOT TRUE
+|  other join predicates: FALSE
 |  runtime filters: RF000 <- b.id
 |
 |--01:SCAN HDFS [functional.alltypestiny b]
@@ -189,7 +189,7 @@ PLAN-ROOT SINK
 |
 02:HASH JOIN [FULL OUTER JOIN]
 |  hash predicates: a.id = b.id
-|  other join predicates: NULL = 'abc'
+|  other join predicates: NULL
 |
 |--01:SCAN HDFS [functional.alltypestiny b]
 |     partitions=4/4 files=4 size=460B

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/insert.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/insert.test b/testdata/workloads/functional-planner/queries/PlannerTest/insert.test
index 4efb68b..f201d0a 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/insert.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/insert.test
@@ -548,7 +548,7 @@ select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col,
 float_col, double_col, date_string_col, string_col, timestamp_col, cast(concat("2", "010") as smallint) - 1
 from functional.alltypes
 ---- DISTRIBUTEDPLAN
-WRITE TO HDFS [functional.alltypes, OVERWRITE=false, PARTITION-KEYS=(CAST(concat('2', '010') AS SMALLINT) - 1,CAST(10 / 2 AS INT))]
+WRITE TO HDFS [functional.alltypes, OVERWRITE=false, PARTITION-KEYS=(2009,5)]
 |  partitions=1
 |
 01:EXCHANGE [UNPARTITIONED]

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/join-order.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/join-order.test b/testdata/workloads/functional-planner/queries/PlannerTest/join-order.test
index 49a0b87..08dbd4d 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/join-order.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/join-order.test
@@ -1487,7 +1487,7 @@ PLAN-ROOT SINK
 select * from functional.alltypes a
 left semi join
 (select * from functional.alltypes
-where timestamp_col = now()) b
+ where timestamp_col = cast("2016-11-20" as timestamp)) b
 on (a.id = b.id)
 and a.date_string_col = ''
 ---- PLAN
@@ -1499,7 +1499,7 @@ PLAN-ROOT SINK
 |
 |--01:SCAN HDFS [functional.alltypes]
 |     partitions=24/24 files=24 size=478.45KB
-|     predicates: timestamp_col = now()
+|     predicates: timestamp_col = TIMESTAMP '2016-11-20 00:00:00'
 |
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
@@ -1511,7 +1511,7 @@ left semi join
 (select * from functional.alltypes
 where date_string_col = '') b
 on (a.id = b.id)
-and a.timestamp_col = now()
+and a.timestamp_col = cast("2016-11-20" as timestamp)
 ---- PLAN
 PLAN-ROOT SINK
 |
@@ -1521,7 +1521,7 @@ PLAN-ROOT SINK
 |
 |--00:SCAN HDFS [functional.alltypes a]
 |     partitions=24/24 files=24 size=478.45KB
-|     predicates: a.timestamp_col = now()
+|     predicates: a.timestamp_col = TIMESTAMP '2016-11-20 00:00:00'
 |
 01:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB
@@ -1532,7 +1532,7 @@ PLAN-ROOT SINK
 select * from functional.alltypes a
 left semi join
 (select * from functional.alltypes
-where timestamp_col <=> now()) b
+where timestamp_col <=> cast("2016-11-20" as timestamp)) b
 on (a.id = b.id)
 and a.date_string_col <=> ''
 ---- PLAN
@@ -1544,7 +1544,7 @@ PLAN-ROOT SINK
 |
 |--01:SCAN HDFS [functional.alltypes]
 |     partitions=24/24 files=24 size=478.45KB
-|     predicates: timestamp_col IS NOT DISTINCT FROM now()
+|     predicates: timestamp_col IS NOT DISTINCT FROM TIMESTAMP '2016-11-20 00:00:00'
 |
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
@@ -1556,7 +1556,7 @@ left semi join
 (select * from functional.alltypes
 where date_string_col <=> '') b
 on (a.id = b.id)
-and a.timestamp_col <=> now()
+and a.timestamp_col <=> cast("2016-11-20" as timestamp)
 ---- PLAN
 PLAN-ROOT SINK
 |
@@ -1566,7 +1566,7 @@ PLAN-ROOT SINK
 |
 |--00:SCAN HDFS [functional.alltypes a]
 |     partitions=24/24 files=24 size=478.45KB
-|     predicates: a.timestamp_col IS NOT DISTINCT FROM now()
+|     predicates: a.timestamp_col IS NOT DISTINCT FROM TIMESTAMP '2016-11-20 00:00:00'
 |
 01:SCAN HDFS [functional.alltypes]
    partitions=24/24 files=24 size=478.45KB

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/joins.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/joins.test b/testdata/workloads/functional-planner/queries/PlannerTest/joins.test
index ba1395a..8161833 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/joins.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/joins.test
@@ -2207,8 +2207,8 @@ PLAN-ROOT SINK
 |  output: count(id)
 |
 02:HASH JOIN [LEFT OUTER JOIN]
-|  hash predicates: t1.id = if(TupleIsNull(), NULL, coalesce(1, 10))
-|  other predicates: if(TupleIsNull(), NULL, coalesce(1, 10)) IN (if(TupleIsNull(), NULL, coalesce(1, 10)), 10)
+|  hash predicates: t1.id = if(TupleIsNull(), NULL, 1)
+|  other predicates: if(TupleIsNull(), NULL, 1) IN (if(TupleIsNull(), NULL, 1), 10)
 |
 |--01:SCAN HDFS [functional.alltypessmall]
 |     partitions=4/4 files=4 size=6.32KB

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/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 6f7bbff..fa54ace 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
@@ -122,7 +122,7 @@ PLAN-ROOT SINK
 |
 00:SCAN KUDU [functional_kudu.testtbl]
    predicates: CAST(sin(id) AS BOOLEAN) = TRUE
-   kudu predicates: id <= 60, id < 40, id < 103
+   kudu predicates: id < 103, id <= 60, id < 40
 ---- SCANRANGELOCATIONS
 NODE 0:
   ScanToken{table=impala::functional_kudu.testtbl, range-partition: [<start>, (int64 id=1004))}
@@ -133,7 +133,7 @@ PLAN-ROOT SINK
 |
 00:SCAN KUDU [functional_kudu.testtbl]
    predicates: CAST(sin(id) AS BOOLEAN) = TRUE
-   kudu predicates: id <= 60, id < 40, id < 103
+   kudu predicates: id < 103, id <= 60, id < 40
 ====
 # Some predicates can be pushed down but others can't (predicate on an non-const value).
 select * from functional_kudu.testtbl
@@ -202,7 +202,7 @@ PLAN-ROOT SINK
 |  order by: c ASC
 |
 00:SCAN KUDU [tpch_kudu.orders]
-   predicates: CAST(o_orderdate AS TIMESTAMP) <= CAST('1995-01-01 00:00:00' AS TIMESTAMP)
+   predicates: CAST(o_orderdate AS TIMESTAMP) <= TIMESTAMP '1995-01-01 00:00:00'
    kudu predicates: o_orderkey < 10
 ====
 # IMPALA-4213: Planner not pushing some predicates with constant exprs to Kudu

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/outer-joins.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/outer-joins.test b/testdata/workloads/functional-planner/queries/PlannerTest/outer-joins.test
index f3e43bd..3a39d14 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/outer-joins.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/outer-joins.test
@@ -749,7 +749,7 @@ PLAN-ROOT SINK
 |
 |--00:SCAN HDFS [functional.alltypes a]
 |     partitions=24/24 files=24 size=478.45KB
-|     predicates: (CASE WHEN a.id > 100 THEN a.timestamp_col ELSE a.timestamp_col END) >= CAST('2001-01-01 00:00:00' AS TIMESTAMP)
+|     predicates: (CASE WHEN a.id > 100 THEN a.timestamp_col ELSE a.timestamp_col END) >= TIMESTAMP '2001-01-01 00:00:00'
 |
 01:SCAN HDFS [functional.alltypes b]
    partitions=24/24 files=24 size=478.45KB

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/predicate-propagation.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/predicate-propagation.test b/testdata/workloads/functional-planner/queries/PlannerTest/predicate-propagation.test
index eeb9b97..0317ae9 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/predicate-propagation.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/predicate-propagation.test
@@ -1132,7 +1132,7 @@ PLAN-ROOT SINK
 |
 04:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: t2.id = functional.alltypestiny.id, t2.int_col = functional.alltypestiny.int_col
-|  other predicates: functional.alltypestiny.tinyint_col + functional.alltypestiny.smallint_col + functional.alltypestiny.int_col > 10, ifnull(functional.alltypestiny.tinyint_col + functional.alltypestiny.bigint_col, TRUE) = TRUE
+|  other predicates: functional.alltypestiny.tinyint_col + functional.alltypestiny.smallint_col + functional.alltypestiny.int_col > 10, ifnull(functional.alltypestiny.tinyint_col + functional.alltypestiny.bigint_col, 1) = 1
 |
 |--02:SCAN HDFS [functional.alltypestiny]
 |     partitions=4/4 files=4 size=460B
@@ -1140,7 +1140,7 @@ PLAN-ROOT SINK
 |
 03:HASH JOIN [LEFT OUTER JOIN]
 |  hash predicates: t1.id = t2.id, t1.int_col = t2.int_col
-|  other predicates: t2.tinyint_col = t2.smallint_col, ifnull(t2.tinyint_col + t2.bigint_col, TRUE) = TRUE
+|  other predicates: t2.tinyint_col = t2.smallint_col, ifnull(t2.tinyint_col + t2.bigint_col, 1) = 1
 |
 |--01:SCAN HDFS [functional.alltypessmall t2]
 |     partitions=4/4 files=4 size=6.32KB
@@ -1352,6 +1352,6 @@ PLAN-ROOT SINK
 |     predicates: n_regionkey = 1, n_name = 'BRAZIL'
 |
 00:SCAN HDFS [tpch_parquet.customer c]
-   partitions=1/1 files=1 size=12.47MB
+   partitions=1/1 files=1 size=12.27MB
    predicates: c_custkey % 2 = 0
 ====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test b/testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test
index dfc9072..85559b6 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/subquery-rewrite.test
@@ -1267,7 +1267,7 @@ PLAN-ROOT SINK
 |
 00:SCAN HDFS [functional.alltypesagg g]
    partitions=11/11 files=11 size=814.73KB
-   predicates: g.bigint_col < 1000, g.bigint_col = TRUE
+   predicates: g.bigint_col = 1, g.bigint_col < 1000
 ====
 # Aggregate subquery in an IS NULL predicate
 select *

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-all.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-all.test b/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-all.test
index c4cbd6f..f630a88 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-all.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/tpcds-all.test
@@ -1209,7 +1209,7 @@ PLAN-ROOT SINK
 |  |
 |  |--01:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: date_dim.d_year IN (1998, 1998 + 1, 1998 + 2), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
+|  |     predicates: date_dim.d_year IN (1998, 1999, 2000), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
 |  |
 |  04:HASH JOIN [INNER JOIN]
 |  |  hash predicates: store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
@@ -1271,7 +1271,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  01:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: date_dim.d_year IN (1998, 1998 + 1, 1998 + 2), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
+|  |     predicates: date_dim.d_year IN (1998, 1999, 2000), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
 |  |
 |  04:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
@@ -1347,7 +1347,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  01:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: date_dim.d_year IN (1998, 1998 + 1, 1998 + 2), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
+|  |     predicates: date_dim.d_year IN (1998, 1999, 2000), (date_dim.d_dom >= 1 AND date_dim.d_dom <= 3 OR date_dim.d_dom >= 25 AND date_dim.d_dom <= 28)
 |  |
 |  04:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
@@ -1798,7 +1798,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  |--01:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: date_dim.d_year IN (1999, 1999 + 1, 1999 + 2), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517
 , 2451518, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 24519
 03, 2451909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
+|  |  |     predicates: date_dim.d_year IN (1999, 2000, 2001), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517, 245151
 8, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 2451903, 2451
 909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
 |  |  |
 |  |  05:HASH JOIN [INNER JOIN]
 |  |  |  hash predicates: customer_address.ca_address_sk = store_sales.ss_addr_sk
@@ -1880,7 +1880,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  01:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: date_dim.d_year IN (1999, 1999 + 1, 1999 + 2), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517
 , 2451518, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 24519
 03, 2451909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
+|  |  |     predicates: date_dim.d_year IN (1999, 2000, 2001), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517, 245151
 8, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 2451903, 2451
 909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
 |  |  |
 |  |  05:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  |  hash predicates: customer_address.ca_address_sk = store_sales.ss_addr_sk
@@ -1984,7 +1984,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  01:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: date_dim.d_year IN (1999, 1999 + 1, 1999 + 2), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517
 , 2451518, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 24519
 03, 2451909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
+|  |  |     predicates: date_dim.d_year IN (1999, 2000, 2001), date_dim.d_dow IN (6, 0), tpcds.date_dim.d_date_sk IN (2451181, 2451182, 2451188, 2451189, 2451195, 2451196, 2451202, 2451203, 2451209, 2451210, 2451216, 2451217, 2451223, 2451224, 2451230, 2451231, 2451237, 2451238, 2451244, 2451245, 2451251, 2451252, 2451258, 2451259, 2451265, 2451266, 2451272, 2451273, 2451279, 2451280, 2451286, 2451287, 2451293, 2451294, 2451300, 2451301, 2451307, 2451308, 2451314, 2451315, 2451321, 2451322, 2451328, 2451329, 2451335, 2451336, 2451342, 2451343, 2451349, 2451350, 2451356, 2451357, 2451363, 2451364, 2451370, 2451371, 2451377, 2451378, 2451384, 2451385, 2451391, 2451392, 2451398, 2451399, 2451405, 2451406, 2451412, 2451413, 2451419, 2451420, 2451426, 2451427, 2451433, 2451434, 2451440, 2451441, 2451447, 2451448, 2451454, 2451455, 2451461, 2451462, 2451468, 2451469, 2451475, 2451476, 2451482, 2451483, 2451489, 2451490, 2451496, 2451497, 2451503, 2451504, 2451510, 2451511, 2451517, 245151
 8, 2451524, 2451525, 2451531, 2451532, 2451538, 2451539, 2451545, 2451546, 2451552, 2451553, 2451559, 2451560, 2451566, 2451567, 2451573, 2451574, 2451580, 2451581, 2451587, 2451588, 2451594, 2451595, 2451601, 2451602, 2451608, 2451609, 2451615, 2451616, 2451622, 2451623, 2451629, 2451630, 2451636, 2451637, 2451643, 2451644, 2451650, 2451651, 2451657, 2451658, 2451664, 2451665, 2451671, 2451672, 2451678, 2451679, 2451685, 2451686, 2451692, 2451693, 2451699, 2451700, 2451706, 2451707, 2451713, 2451714, 2451720, 2451721, 2451727, 2451728, 2451734, 2451735, 2451741, 2451742, 2451748, 2451749, 2451755, 2451756, 2451762, 2451763, 2451769, 2451770, 2451776, 2451777, 2451783, 2451784, 2451790, 2451791, 2451797, 2451798, 2451804, 2451805, 2451811, 2451812, 2451818, 2451819, 2451825, 2451826, 2451832, 2451833, 2451839, 2451840, 2451846, 2451847, 2451853, 2451854, 2451860, 2451861, 2451867, 2451868, 2451874, 2451875, 2451881, 2451882, 2451888, 2451889, 2451895, 2451896, 2451902, 2451903, 2451
 909, 2451910, 2451916, 2451917, 2451923, 2451924, 2451930, 2451931, 2451937, 2451938, 2451944, 2451945, 2451951, 2451952, 2451958, 2451959, 2451965, 2451966, 2451972, 2451973, 2451979, 2451980, 2451986, 2451987, 2451993, 2451994, 2452000, 2452001, 2452007, 2452008, 2452014, 2452015, 2452021, 2452022, 2452028, 2452029, 2452035, 2452036, 2452042, 2452043, 2452049, 2452050, 2452056, 2452057, 2452063, 2452064, 2452070, 2452071, 2452077, 2452078, 2452084, 2452085, 2452091, 2452092, 2452098, 2452099, 2452105, 2452106, 2452112, 2452113, 2452119, 2452120, 2452126, 2452127, 2452133, 2452134, 2452140, 2452141, 2452147, 2452148, 2452154, 2452155, 2452161, 2452162, 2452168, 2452169, 2452175, 2452176, 2452182, 2452183, 2452189, 2452190, 2452196, 2452197, 2452203, 2452204, 2452210, 2452211, 2452217, 2452218, 2452224, 2452225, 2452231, 2452232, 2452238, 2452239, 2452245, 2452246, 2452252, 2452253, 2452259, 2452260, 2452266, 2452267, 2452273, 2452274)
 |  |  |
 |  |  05:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  |  hash predicates: customer_address.ca_address_sk = store_sales.ss_addr_sk
@@ -2227,7 +2227,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ---- DISTRIBUTEDPLAN
 PLAN-ROOT SINK
@@ -2280,7 +2280,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ---- PARALLELPLANS
 PLAN-ROOT SINK
@@ -2345,7 +2345,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ====
 # TPCDS-Q55
@@ -2599,7 +2599,7 @@ PLAN-ROOT SINK
 |  |
 |  |--13:SCAN HDFS [tpcds.date_dim d]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: d_month_seq <= 1185 + 23, d_month_seq >= 1185 + 12
+|  |     predicates: d_month_seq <= 1208, d_month_seq >= 1197
 |  |
 |  11:AGGREGATE [FINALIZE]
 |  |  output: sum(CASE WHEN (d_day_name = 'Sunday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Monday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Tuesday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Wednesday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Thursday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Friday') THEN ss_sales_price ELSE NULL END), sum(CASE WHEN (d_day_name = 'Saturday') THEN ss_sales_price ELSE NULL END)
@@ -2631,7 +2631,7 @@ PLAN-ROOT SINK
 |
 |--05:SCAN HDFS [tpcds.date_dim d]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: d_month_seq >= 1185, d_month_seq <= 1185 + 11
+|     predicates: d_month_seq <= 1196, d_month_seq >= 1185
 |     runtime filters: RF000 -> d.d_week_seq
 |
 03:AGGREGATE [FINALIZE]
@@ -2682,7 +2682,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  13:SCAN HDFS [tpcds.date_dim d]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: d_month_seq <= 1185 + 23, d_month_seq >= 1185 + 12
+|  |     predicates: d_month_seq <= 1208, d_month_seq >= 1197
 |  |
 |  27:AGGREGATE [FINALIZE]
 |  |  output: sum:merge(CASE WHEN (d_day_name = 'Sunday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Monday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Tuesday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Wednesday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Thursday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Friday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Saturday') THEN ss_sales_price ELSE NULL END)
@@ -2730,7 +2730,7 @@ PLAN-ROOT SINK
 |  |
 |  05:SCAN HDFS [tpcds.date_dim d]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: d_month_seq >= 1185, d_month_seq <= 1185 + 11
+|     predicates: d_month_seq <= 1196, d_month_seq >= 1185
 |     runtime filters: RF000 -> d.d_week_seq
 |
 21:AGGREGATE [FINALIZE]
@@ -2803,7 +2803,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  13:SCAN HDFS [tpcds.date_dim d]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: d_month_seq <= 1185 + 23, d_month_seq >= 1185 + 12
+|  |     predicates: d_month_seq <= 1208, d_month_seq >= 1197
 |  |
 |  27:AGGREGATE [FINALIZE]
 |  |  output: sum:merge(CASE WHEN (d_day_name = 'Sunday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Monday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Tuesday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Wednesday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Thursday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Friday') THEN ss_sales_price ELSE NULL END), sum:merge(CASE WHEN (d_day_name = 'Saturday') THEN ss_sales_price ELSE NULL END)
@@ -2863,7 +2863,7 @@ PLAN-ROOT SINK
 |  |
 |  05:SCAN HDFS [tpcds.date_dim d]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: d_month_seq >= 1185, d_month_seq <= 1185 + 11
+|     predicates: d_month_seq <= 1196, d_month_seq >= 1185
 |     runtime filters: RF000 -> d.d_week_seq
 |
 21:AGGREGATE [FINALIZE]
@@ -2977,7 +2977,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ---- DISTRIBUTEDPLAN
 PLAN-ROOT SINK
@@ -3040,7 +3040,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ---- PARALLELPLANS
 PLAN-ROOT SINK
@@ -3115,7 +3115,7 @@ PLAN-ROOT SINK
 |
 02:SCAN HDFS [tpcds.date_dim]
    partitions=1/1 files=1 size=9.84MB
-   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1212 + 1, 1212 + 2, 1212 + 3, 1212 + 4, 1212 + 5, 1212 + 6, 1212 + 7, 1212 + 8, 1212 + 9, 1212 + 10, 1212 + 11)
+   predicates: tpcds.date_dim.d_date_sk <= 2452275, tpcds.date_dim.d_date_sk >= 2451911, d_month_seq IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223)
    runtime filters: RF001 -> d_date_sk
 ====
 # TPCDS-Q65
@@ -3206,7 +3206,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  |--03:SCAN HDFS [tpcds.date_dim]
 |  |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |  |
 |  |  |  02:SCAN HDFS [tpcds.store_sales]
 |  |  |     partitions=120/120 files=120 size=21.31MB
@@ -3222,7 +3222,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  |--08:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |
 |  |  07:SCAN HDFS [tpcds.store_sales]
 |  |     partitions=120/120 files=120 size=21.31MB
@@ -3292,7 +3292,7 @@ PLAN-ROOT SINK
 |  |  |  |  |
 |  |  |  |  03:SCAN HDFS [tpcds.date_dim]
 |  |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |  |
 |  |  |  02:SCAN HDFS [tpcds.store_sales]
 |  |  |     partitions=120/120 files=120 size=21.31MB
@@ -3316,7 +3316,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  08:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |
 |  |  07:SCAN HDFS [tpcds.store_sales]
 |  |     partitions=120/120 files=120 size=21.31MB
@@ -3402,7 +3402,7 @@ PLAN-ROOT SINK
 |  |  |  |  |
 |  |  |  |  03:SCAN HDFS [tpcds.date_dim]
 |  |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |  |
 |  |  |  02:SCAN HDFS [tpcds.store_sales]
 |  |  |     partitions=120/120 files=120 size=21.31MB
@@ -3430,7 +3430,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  08:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: d_month_seq >= 1212, d_month_seq <= 1212 + 11
+|  |  |     predicates: d_month_seq <= 1223, d_month_seq >= 1212
 |  |  |
 |  |  07:SCAN HDFS [tpcds.store_sales]
 |  |     partitions=120/120 files=120 size=21.31MB
@@ -5179,7 +5179,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  |--02:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |  |
 |  |  04:HASH JOIN [INNER JOIN]
 |  |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5218,7 +5218,7 @@ PLAN-ROOT SINK
 |  |
 |  |--15:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |
 |  17:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5257,7 +5257,7 @@ PLAN-ROOT SINK
 |
 |--25:SCAN HDFS [tpcds.date_dim]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |
 27:HASH JOIN [INNER JOIN]
 |  hash predicates: ss_item_sk = i_item_sk
@@ -5335,7 +5335,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  02:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |  |
 |  |  04:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5386,7 +5386,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  15:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |
 |  17:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5437,7 +5437,7 @@ PLAN-ROOT SINK
 |  |
 |  25:SCAN HDFS [tpcds.date_dim]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |
 27:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: ss_item_sk = i_item_sk
@@ -5533,7 +5533,7 @@ PLAN-ROOT SINK
 |  |  |  |
 |  |  |  02:SCAN HDFS [tpcds.date_dim]
 |  |  |     partitions=1/1 files=1 size=9.84MB
-|  |  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |  |
 |  |  04:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5596,7 +5596,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  15:SCAN HDFS [tpcds.date_dim]
 |  |     partitions=1/1 files=1 size=9.84MB
-|  |     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|  |     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |  |
 |  17:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_item_sk = i_item_sk
@@ -5659,7 +5659,7 @@ PLAN-ROOT SINK
 |  |
 |  25:SCAN HDFS [tpcds.date_dim]
 |     partitions=1/1 files=1 size=9.84MB
-|     predicates: (d_year = 2000 OR (d_year = 2000 - 1 AND d_moy = 12) OR (d_year = 2000 + 1 AND d_moy = 1))
+|     predicates: (d_year = 2000 OR (d_year = 1999 AND d_moy = 12) OR (d_year = 2001 AND d_moy = 1))
 |
 27:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: ss_item_sk = i_item_sk
@@ -6133,7 +6133,7 @@ PLAN-ROOT SINK
 |  |
 |  |--57:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  60:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6164,7 +6164,7 @@ PLAN-ROOT SINK
 |  |
 |  |--49:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  52:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6195,7 +6195,7 @@ PLAN-ROOT SINK
 |  |
 |  |--41:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  44:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6226,7 +6226,7 @@ PLAN-ROOT SINK
 |  |
 |  |--33:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  36:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6257,7 +6257,7 @@ PLAN-ROOT SINK
 |  |
 |  |--25:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  28:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6288,7 +6288,7 @@ PLAN-ROOT SINK
 |  |
 |  |--17:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  20:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6320,7 +6320,7 @@ PLAN-ROOT SINK
 |  |
 |  |--09:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  12:HASH JOIN [INNER JOIN]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6350,7 +6350,7 @@ PLAN-ROOT SINK
 |
 |--01:SCAN HDFS [tpcds.household_demographics]
 |     partitions=1/1 files=1 size=148.10KB
-|     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |
 04:HASH JOIN [INNER JOIN]
 |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6406,7 +6406,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  57:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  60:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6466,7 +6466,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  49:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  52:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6526,7 +6526,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  41:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  44:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6586,7 +6586,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  33:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  36:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6646,7 +6646,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  25:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  28:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6706,7 +6706,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  17:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  20:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6767,7 +6767,7 @@ PLAN-ROOT SINK
 |  |  |
 |  |  09:SCAN HDFS [tpcds.household_demographics]
 |  |     partitions=1/1 files=1 size=148.10KB
-|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|  |     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |  |
 |  12:HASH JOIN [INNER JOIN, BROADCAST]
 |  |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk
@@ -6820,7 +6820,7 @@ PLAN-ROOT SINK
 |  |
 |  01:SCAN HDFS [tpcds.household_demographics]
 |     partitions=1/1 files=1 size=148.10KB
-|     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 1 + 2) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 0 + 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 2 + 2))
+|     predicates: ((household_demographics.hd_dep_count = 1 AND household_demographics.hd_vehicle_count <= 3) OR (household_demographics.hd_dep_count = 0 AND household_demographics.hd_vehicle_count <= 2) OR (household_demographics.hd_dep_count = 2 AND household_demographics.hd_vehicle_count <= 4))
 |
 04:HASH JOIN [INNER JOIN, BROADCAST]
 |  hash predicates: ss_sold_time_sk = time_dim.t_time_sk

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-planner/queries/PlannerTest/values.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/values.test b/testdata/workloads/functional-planner/queries/PlannerTest/values.test
index a27c793..87e9aa8 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/values.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/values.test
@@ -15,7 +15,7 @@ values(1+1, 2, 5.0, 'a') order by 1 limit 10
 PLAN-ROOT SINK
 |
 01:TOP-N [LIMIT=10]
-|  order by: 1 + 1 ASC
+|  order by: 2 ASC
 |
 00:UNION
    constant-operands=1
@@ -23,7 +23,7 @@ PLAN-ROOT SINK
 PLAN-ROOT SINK
 |
 01:TOP-N [LIMIT=10]
-|  order by: 1 + 1 ASC
+|  order by: 2 ASC
 |
 00:UNION
    constant-operands=1
@@ -45,7 +45,7 @@ values((1+1, 2, 5.0, 'a'), (2, 3, 6.0, 'b'), (3, 4, 7.0, 'c')) order by 1 limit
 PLAN-ROOT SINK
 |
 01:TOP-N [LIMIT=10]
-|  order by: 1 + 1 ASC
+|  order by: 2 ASC
 |
 00:UNION
    constant-operands=3
@@ -53,7 +53,7 @@ PLAN-ROOT SINK
 PLAN-ROOT SINK
 |
 01:TOP-N [LIMIT=10]
-|  order by: 1 + 1 ASC
+|  order by: 2 ASC
 |
 00:UNION
    constant-operands=3

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-query/queries/QueryTest/exprs.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/exprs.test b/testdata/workloads/functional-query/queries/QueryTest/exprs.test
index ba8d4fb..2f04db9 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/exprs.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/exprs.test
@@ -2531,3 +2531,35 @@ select count(shiftleft(int_col, 1)) from functional_parquet.alltypes
 ---- TYPES
 bigint
 ====
+---- QUERY
+# Test constant timestamp expressions in various query clauses. Exercises
+# timestamp literals when run with expr rewrites enabled.
+select count(now()) c, avg(cast('2016-11-22 16:40:00.00' as timestamp)) a,
+  cast('2016-11-22 16:40:00.00' as timestamp) as g
+from functional_parquet.alltypes
+where timestamp_col < cast('2013-02-18 20:46:00.01' as timestamp)
+group by g
+having a = cast('2016-11-22 16:40:00.00' as timestamp)
+order by c, cast('2016-11-22 16:40:00.00' as timestamp)
+---- RESULTS
+7300,2016-11-22 16:40:00,2016-11-22 16:40:00
+---- TYPES
+BIGINT, TIMESTAMP, TIMESTAMP
+====
+---- QUERY
+# Constant timestamp expresisons in a join condition / runtime filter as well
+# as a select node.
+select count(*) from (
+  select a.timestamp_col from
+  functional_parquet.alltypessmall a
+  inner join functional_parquet.alltypestiny b
+  on cast('2013-02-18 20:46:00.01' as timestamp) + interval a.id years =
+     cast('2013-02-18 20:46:00.01' as timestamp) + interval b.id years
+  order by a.timestamp_col limit 10
+) v
+where timestamp_col < cast('2013-02-18 20:46:00.01' as timestamp)
+---- RESULTS
+8
+---- TYPES
+BIGINT
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/testdata/workloads/functional-query/queries/QueryTest/udf.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/udf.test b/testdata/workloads/functional-query/queries/QueryTest/udf.test
index ef777a1..b3f8dfa 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/udf.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/udf.test
@@ -440,20 +440,6 @@ BOOLEAN
 true
 ====
 ---- QUERY
-select count_rows() from functional.alltypestiny
----- TYPES
-BIGINT
----- RESULTS
-1
-2
-3
-4
-5
-6
-7
-8
-====
----- QUERY
 select constant_arg(1), constant_arg(int_col) from functional.alltypestiny limit 1;
 ---- TYPES
 int,int
@@ -536,3 +522,19 @@ INT
 ---- RESULTS
 210
 ====
+---- QUERY
+# Disable expr rewrites (constant folding) because count_rows() is non-deterministic.
+set enable_expr_rewrites=false;
+select count_rows() from functional.alltypestiny;
+---- TYPES
+BIGINT
+---- RESULTS
+1
+2
+3
+4
+5
+6
+7
+8
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/bbf5255d/tests/query_test/test_exprs.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_exprs.py b/tests/query_test/test_exprs.py
index 6c82df4..3a9beb3 100644
--- a/tests/query_test/test_exprs.py
+++ b/tests/query_test/test_exprs.py
@@ -15,13 +15,12 @@
 # specific language governing permissions and limitations
 # under the License.
 
-# Validates limit on scan nodes
-
 import pytest
 
 from tests.common.impala_test_suite import ImpalaTestSuite
 from tests.common.test_dimensions import create_exec_option_dimension
 from tests.common.test_dimensions import create_uncompressed_text_dimension
+from tests.common.test_vector import TestDimension
 from tests.util.test_file_parser import QueryTestSectionReader
 
 class TestExprs(ImpalaTestSuite):
@@ -32,6 +31,9 @@ class TestExprs(ImpalaTestSuite):
   @classmethod
   def add_test_dimensions(cls):
     super(TestExprs, cls).add_test_dimensions()
+    # Test with and without expr rewrites to cover regular expr evaluations
+    # as well as constant folding, in particular, timestamp literals.
+    cls.TestMatrix.add_dimension(TestDimension('enable_expr_rewrites', *[0,1]))
     if cls.exploration_strategy() == 'core':
       # Test with file format that supports codegen
       cls.TestMatrix.add_constraint(lambda v:\
@@ -39,6 +41,8 @@ class TestExprs(ImpalaTestSuite):
           v.get_value('table_format').compression_codec == 'none')
 
   def test_exprs(self, vector):
+    vector.get_value('exec_option')['enable_expr_rewrites'] = \
+        vector.get_value('enable_expr_rewrites')
     # TODO: Enable some of these tests for Avro if possible
     # Don't attempt to evaluate timestamp expressions with Avro tables (which don't
     # support a timestamp type)"


Mime
View raw message