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

RelStructuredTypeFlattener: improve support for functions with struct input

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.22.0
    • 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

              ihuzenko Igor Guzenko
              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