Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1856

Add option StructKind.PEEK_FIELDS_NO_EXPAND, similar to PEEK_FIELDS but is not expanded in "SELECT *"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.14.0
    • Component/s: core
    • Labels:
      None

      Description

      In Calcite, StructKind.PEEK_FIELDS allow see its fields without qualifying them with the name of this field. For example, if address is labeled PEEK_FIELDS, one could write zipcode as shorthand for address.zipcode, i.e., the following SQL is allowed:

      Select zipcode from T
      

      StructKind.FULLY_QUALIFIED is the normal SQL behavior, where each field must be referenced explicitly, i.e. the above SQL will fail.

      But currently in calcite, a side effect of using PEEK_FIELDS is that "select *" will recursively flatten the PEEK_FIELDS RecordType. We want to add an option call PEEK_FIELDS_NO_FLATTENING to disable the behavior.

      With the new option, if the table structure T is as follows:

      VARCHAR K0,
      VARCHAR C1,
      RecordType:peek_no_flattening(INTEGER C0, INTEGER C1) F0,
      RecordType:peek_no_flattening(INTEGER C0, INTEGER C2) F1
      
      

      The following query

      Select * from T
      

      will return (K0, C1, F0, F1) instead of (K0, C1, F0.C0, F0.C1, F1.C0, F1.C1)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                suez1224 Shuyi Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: