[ 
https://issues.apache.org/jira/browse/IMPALA-14814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18081105#comment-18081105
 ] 

ASF subversion and git services commented on IMPALA-14814:
----------------------------------------------------------

Commit 3a718a37691df6ff38b3ef65e76cdf0f96cffca4 in impala's branch 
refs/heads/master from Steve Carlin
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=3a718a376 ]

IMPALA-14814: Handle implicit casts properly for Calcite Planner

Previous to this commit, the Calcite planner overrode the isImplicit()
method to prevent the framework from removing implicit casts. The
reasoning behind this was because Calcite has already gone through the
analysis phase and determined that a cast was necessary.

The original planner combines the substitution of slot refs
with the removal of implicit casts and then re-analyzes the Expr object.
So Calcite needs to avoid this removal.

On first pass, it seemed that removing any recognition of the existence
of an implicit cast was an adequate solution. However, in certain cases,
like the analysis of parquet stats, the physical planner needs to know
if the cast is explicit or implicit.

This commit now sets the isImplicit_ variable correctly in the
AnalyzedCastExpr through the CastExpr constructor.

The code within substituteImpl that removes the cast has been moved into
the child CastExpr class. A new method, shouldRemoveImplicitCast(),
will return the isImplicit() value for the CastExpr class but will always
return false for the Calcite AnalyzedCastExpr class. In addition to this
change, the "hashCode()" method is also used within the ExprSubstitutionMap
so that code also needs to be avoided in the child AnalyzedCastExpr class.

Change-Id: I4d71357ac7f228404713f96884d9eff7f8eabe5c
Reviewed-on: http://gerrit.cloudera.org:8080/24247
Reviewed-by: Michael Smith <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
Reviewed-by: Steve Carlin <[email protected]>


> Calcite planner: orc stats predicate not created due to decimal cast
> --------------------------------------------------------------------
>
>                 Key: IMPALA-14814
>                 URL: https://issues.apache.org/jira/browse/IMPALA-14814
>             Project: IMPALA
>          Issue Type: Sub-task
>            Reporter: Steve Carlin
>            Priority: Major
>
> In orc-stats.test for the following query:
> select count(*) from functional_orc_def.decimal_tbl where d1 > 132842.0;
> The orc statistics predicate is not getting created in the Calcite Planner.
> This is because the predicate is finding a common type for the filter 
> condition, which is:
> CAST(functional_orc_def.decimal_tbl.d1 AS DECIMAL(10,1)) > CAST(132842.0 AS 
> DECIMAL(10,1))
> d1 is a (9,0)
> In the original planner, no casting is done, so the orc stats predicate gets 
> created:
> d1 > CAST(132842.0 AS DECIMAL(7,1))



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to