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

RelStructuredTypeFlattener: improve support for functions with struct input

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.22.0
    • Component/s: core

      Description

      1. RelStructuredTypeFlattener doesn't support aggregate functions for struct type column.
      Example test case:

        @Test
        public void testAggregateFunctionWithStructInput() {
          final String sql =
              "select count(dn.skill) from sales.dept_nested dn";
          sql(sql).ok();
        }
      

      2. For other functions, except ITEM, flattener uses first nested primitive field from
      original struct input. Example test case:

        @Test
        public void testFunctionWithStructInput() {
          final String sql =
              "select json_type(dn.skill) from sales.dept_nested dn";
          sql(sql).ok();
        }
      

      Generated plan:

      LogicalProject(EXPR$0=[JSON_TYPE($2.TYPE)])
        LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]])
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ihuzenko Igor Guzenko
                Reporter:
                ihuzenko Igor Guzenko
              • 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 - 1.5h
                  1.5h