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 "Paul Rogers (JIRA)" <ji...@apache.org> on 2019/03/01 17:51:00 UTC

[jira] [Assigned] (IMPALA-7950) Implicit cast does not propagate NDV

     [ https://issues.apache.org/jira/browse/IMPALA-7950?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Rogers reassigned IMPALA-7950:
-----------------------------------

    Assignee:     (was: Paul Rogers)

> Implicit cast does not propagate NDV
> ------------------------------------
>
>                 Key: IMPALA-7950
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7950
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Frontend
>    Affects Versions: Impala 3.1.0
>            Reporter: Paul Rogers
>            Priority: Minor
>
> See the scenario in IMPALA-7949 in which we have the following SELECT list expression:
> {code:sql}
> cast(0 as double) = id
> {code}
> Analysis of this expression inserts an implicit cast to force {{id}} to the same {{DOUBLE}} type as the constant:
> {code:sql}
> CAST(0 AS DOUBLE) = CAST(id AS DOUBLE)
> {code}
> The code to do this is in the {{CastExpr(Type targetType, Expr e)}} constructor. This constructor attempts to analyze the new cast node, but does so incorrectly. (The code is a copy of the analysis code rather than a call to it.) The code calls {{computeNumDistinctValues()}} which determines that the cast is not a constant, and sets the NDV to -1.
> The correct answer is to propagate NDV up from the child element. Since NDV of id is 7300, the NDV of the cast should also be 7300. An even better answer is to use the existing analysis code to do the analysis, rather than making a copy.



--
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