Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-7896

Literals should not need explicit analyze step

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 3.0
    • None
    • Frontend
    • None
    • ghx-label-3

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              Paul.Rogers Paul Rogers
              Paul.Rogers Paul Rogers
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: