[
https://issues.apache.org/jira/browse/IMPALA-13712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18054936#comment-18054936
]
ASF subversion and git services commented on IMPALA-13712:
----------------------------------------------------------
Commit 593b0bfad3e04d83193f599bc274e873235cebeb in impala's branch
refs/heads/master from Steve Carlin
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=593b0bfad ]
IMPALA-13712: Calcite Planner - Enable constant folding
Constant folding is enabled by this patch.
Calcite does constant folding via the RexExecutor.reduce()
method. However, we need to use Impala's constant folding algorithm
to ensure that Impala expressions are folded. This is done through
the derived class ImpalaRexExecutor and is called from the
Simplify rules.
The ImpalaRexExecutor calls an internal shuttle class which
recursively walks through the RexNode which checks if portions of
the expression can be constant folded.
Some expressions are not folded due to various reasons:
- We avoid folding 'cast(1.2 as double)' type expressions
because folding this creates an inexact number, and this is
problematic for partition pruning directory names on double
columns which contain the exact number (1.2 in this case).
- Interval expressions are skipped temporarily since the Expr
class generated is not meant to be simplified. However, an
Expr object that contains an IntervalExpr may be simplified.
There is a special case that needed to be handled for a values
query with different sized arguments across rows. In Calcite
version 1.40 (not yet upgraded as of this commit), an extra
cast is added around smaller strings to ensure the char(x)
is the same size across all rows. However, this adds extra spaces
to the string which causes results different from the original
Impala planner. This must be caught before Calcite converts the
abstract syntax tree into a RelNode logical tree. A special
RexExecutor has been created to handle this which looks for char
casts around a char literal and removes it. This is fine because
the literal will be changed into a string in the "coercenodes"
module.
Change-Id: I98c21ef75b2f5f8e3390ff5de5fdf45d9645b326
Reviewed-on: http://gerrit.cloudera.org:8080/23723
Reviewed-by: Michael Smith <[email protected]>
Reviewed-by: Joe McDonnell <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Calcite planner: Enable Impala constant folding
> -----------------------------------------------
>
> Key: IMPALA-13712
> URL: https://issues.apache.org/jira/browse/IMPALA-13712
> Project: IMPALA
> Issue Type: Sub-task
> Reporter: Steve Carlin
> Assignee: Steve Carlin
> Priority: Major
> Fix For: Impala 5.0.0
>
>
> After IMPALA-13711 has been implemented (disabling Calcite's constant
> folding), we need to implement Impala's constant folding
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]