Files
impala/testdata/workloads/functional-query/queries/QueryTest/exprs.test
Bikramjeet Vig 545163bb0a IMPALA-5929: Remove redundant explicit casts to string
This patch adds a query rewriter to remove redundant explicit casts to
a string type (string, char, varchar) from binary predicates of the form
"cast(<non-const expr> to <string type>) <eq/ne op> <string constant>".
The cast is redundant if the predicate evaluation is the same even if
the cast is removed and the constant is converted to the original type
of the expression. For example:
cast(int_col as string) = '123456' -> int_col = 123456

Performance:
For the following query on a table having 6001215 records -
select * from tpch.lineitem where cast(l_linenumber as string) = '0'

+-----------------+-----------+--------+
|                 |      Scan Time     |
+-----------------+-----------+--------+
|                 | Avg       | St dev |
| Without rewrite | 1s406ms   | 44ms   |
| With rewrite    | 1s099ms   | 28ms   |
+-----------------+-----------+--------+

Testing:
- Added unit tests to ExprRewriteRulesTest
- Added functional test to expr.test
- Current FE planner tests and BE expr-test run successfully with this
change.

Change-Id: I91b7c6452d0693115f9b9ed9ba09f3ffe0f36b2b
Reviewed-on: http://gerrit.cloudera.org:8080/8660
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Impala Public Jenkins
2018-01-03 01:15:42 +00:00

70 KiB