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

Allow ITEM operator on ROW/STRUCT data types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.27.0
    • 1.27.0
    • core

    Description

      The current implementation of the "ITEM" operator cannot be apply to row/struct type.

      The idea is to extend "ITEM" to support a signature "<ROW>[<CHARACTER|INTEGER>]", allowing to access elements by their position (1-based index), or their name (if available).

       

      The current implementation supports an SQL query as follows:

      select au."birthPlace"."city" as city from "bookstore"."authors" au;

        

      The extended implementation will also support the following equivalent query:

      select au."birthPlace"['city'] as city from "bookstore"."authors" au;
      

       

      And since we have that "birthPlace(coords, city, country)", we can also access "city" with its index 2: 

      select au."birthPlace"[2] as city from "bookstore"."authors" au;

       

      Attachments

        Issue Links

          Activity

            People

              asolimando Alessandro Solimando
              asolimando Alessandro Solimando
              Votes:
              0 Vote for this issue
              Watchers:
              5 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 - 7.5h
                  7.5h