You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/27 00:53:00 UTC

[jira] [Created] (IMPALA-7896) Literals should not need explicit analyze step

Paul Rogers created IMPALA-7896:
-----------------------------------

             Summary: Literals should not need explicit analyze step
                 Key: IMPALA-7896
                 URL: https://issues.apache.org/jira/browse/IMPALA-7896
             Project: IMPALA
          Issue Type: Improvement
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


The Impala FE has the concept of a _lteral_ (string, boolean, null, number.) Originally, literals could only be created as part of the AST. Hence, all literals are subclasses of {{LiteralExpr}} which are {{ExprNodes}}. The analysis step is used to set the type of the literal numbers, when not known at create time. If literals were used only in the AST, this would be fine, they could be analyzed with an analyzer.

In fact, as the code has evolved, {{LiteralExpr}} nodes are created via the catalog, which has no analyzer. To fudge the issue, the {{LiteralExpr.create()}} function does analysis with a null analyzer. This, in turn, means that the {{analyze()}} code needs to special case a null analyzer. This, in turn, leads to brittle, error prone code.

Since literals are immutable (except, sadly, for type), it is better that they start analyzed. Since the only attribute which must be set is the type, and the type can be known at create time, we have the {{analyze()}} be an optional no-op, leading to cleaner semantics.




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