Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/19572 )
Change subject: IMPALA-11960: Fix constant propagation from TIMESTAMP to DATE ...................................................................... IMPALA-11960: Fix constant propagation from TIMESTAMP to DATE The constant propagation introduced in IMPALA-10064 handled conversion of < and > predicates from timestamps to dates incorrectly. Example: select * from functional.alltypes_date_partition where date_col = cast(timestamp_col as date) and timestamp_col > '2009-01-01 01:00:00' and timestamp_col < '2009-02-01 01:00:00'; Before this change query rewrites added the following predicates: date_col > DATE '2009-01-01' AND date_col < DATE '2009-02-01' This incorrectly rejected all timestamps on the days of the lower / upper bounds. The fix is to rewrite < and > to <= and >= in the date predicates. < could be kept if the upper bound is a constant with no time-of-day part, e.g. timestamp_col < "2009-01-01" could be rewritten to date_col < "2009-01-01", but this optimization is not added in this patch to make it simpler. Testing: - added planner + EE regression tests Change-Id: I1938bf5e91057b220daf8a1892940f674aac3d68 Reviewed-on: http://gerrit.cloudera.org:8080/19572 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> --- M fe/src/main/java/org/apache/impala/analysis/ConstantPredicateHandler.java M testdata/workloads/functional-planner/queries/PlannerTest/constant-propagation.test M testdata/workloads/functional-query/queries/QueryTest/range-constant-propagation.test 3 files changed, 64 insertions(+), 2 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/19572 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I1938bf5e91057b220daf8a1892940f674aac3d68 Gerrit-Change-Number: 19572 Gerrit-PatchSet: 6 Gerrit-Owner: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Aman Sinha <amsi...@cloudera.com> Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Daniel Becker <daniel.bec...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com>