Hello Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16407
to look at the new patch set (#2).
Change subject: IMPALA-10116: Allow unwrapping a builtin cast function similar
to CastExpr
......................................................................
IMPALA-10116: Allow unwrapping a builtin cast function similar to CastExpr
This change allows unwrapping a builtin cast function such as
casttobigint(col) similar to a CAST(col as bigint). Unwrapping
is useful to access the SlotRef of the column and this in turn
is needed to compute predicate selectivity correctly. Without
unwrapping, the cast function uses default 10 % selectivity
for a predicate such as 'casttobigint(l_quantity) is NOT NULL'
which is not accurate.
Note that Impala does not allow a user query to directly call the
builtin cast function..rather they have to use the explicit CAST
syntax. However, since the frontend jar can be used by an external
frontend module as a library, the builtin function can be called
and this patch makes the behavior consistent.
Testing:
- Ran PlannerTest
- Manual testing by commenting out the code in
FunctionCallExpr.analyzeImpl() that throws an AnalysisException
if builtin cast function is called. I haven't added a new test
for this reason.
Cardinality before this change:
explain select * from date_dim d1, date_dim d2
where d1.d_week_seq = d2.d_week_seq - 52
and casttobigint(d1.d_week_seq) is not null
and casttobigint(d2.d_week_seq) is not null
SCAN HDFS [tpcds.date_dim d1]
HDFS partitions=1/1 files=1 size=9.84MB
predicates: casttobigint(d1.d_week_seq) IS NOT NULL
runtime filters: RF000 -> d1.d_week_seq
row-size=255B cardinality=7.30K
Cardinality after this change:
SCAN HDFS [tpcds.date_dim d1]
HDFS partitions=1/1 files=1 size=9.84MB
predicates: casttobigint(d1.d_week_seq) IS NOT NULL
runtime filters: RF000 -> d1.d_week_seq
row-size=255B cardinality=73.05K
Change-Id: Idf82b2de78c6a7051ea036062f177d69e2558940
---
M fe/src/main/java/org/apache/impala/analysis/Expr.java
M fe/src/main/java/org/apache/impala/analysis/FunctionCallExpr.java
2 files changed, 7 insertions(+), 4 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/07/16407/2
--
To view, visit http://gerrit.cloudera.org:8080/16407
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Idf82b2de78c6a7051ea036062f177d69e2558940
Gerrit-Change-Number: 16407
Gerrit-PatchSet: 2
Gerrit-Owner: Aman Sinha <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>