You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2018/10/26 00:08:00 UTC

[jira] [Commented] (IMPALA-7766) Perform constant folding within an expression

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

Tim Armstrong commented on IMPALA-7766:
---------------------------------------

I think we should be folding subexpressions - maybe the problem is that id + 1 + 2 is being parsed as (id + 1) + 2 and there isn't a constant subexpression. In that case I think the solution is to reassociate somehow so that it's in the form id + (1 + 2) or similar.

> Perform constant folding within an expression
> ---------------------------------------------
>
>                 Key: IMPALA-7766
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7766
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Frontend
>    Affects Versions: Impala 3.0
>            Reporter: Paul Rogers
>            Priority: Minor
>
> Suppose we have the following query:
> {code:sql}
> SELECT id + 1 + 2, 2 + 3 FROM foo;
> {code}
> Then, examine the SELECT after rewrites (using the new {{FullRewriteTest}}.) We'd expect content folding. However, constant folding only happens if the entire expression is constant, it can't handle sub-expressions. Result:
> {code:sql}
> SELECT id + 1 + 2, 5 FROM foo;
> {code}
> Constant folding within an expression is tricky, and it is not clear what, if any, performance gain would be had. Still, it is worth keeping in mind.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org