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

Implement BigQuery Array Subscript Operators

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.35.0
    • None

    Description

      When indexing an array in BigQuery, you are required to wrap the index in one of four position keywords: OFFSET, ORDINAL, SAFE_OFFSET, and SAFE_ORDINAL.

      OFFSET(index): The index starts at zero. Produces an error if the index is out of range.
      SAFE_OFFSET(index): The index starts at zero. Returns NULL if the index is out of range.
      ORDINAL(index): The index starts at one. Produces an error if the index is out of range.
      SAFE_ORDINAL(index): The index starts at one. Returns NULL if the index is out of range.

      These operators are very similar to the existing ITEM operator currently used to index an array in Calcite. I believe the offset and out of bounds behavior for the existing implementation could be parameterized to support the above operators.

      Link to BigQuery docs

      I will have a PR open for this in the next day or two, in the meantime any comments, questions, or suggestions are welcome as always.

      Attachments

        Issue Links

          Activity

            People

              tanclary Tanner Clary
              tanclary Tanner Clary
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m