Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3271 Table-valued function windowing and EMIT syntax support in Calcite
  3. CALCITE-3788

SqlValidatorImpl.registerOperandSubQueries should skip creating SCALAR_QUERY call when operand is a SqlSelect cause the SqlSelect does not return a scalar value

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • None
    • None
    • None

    Description

      For a table function which uses named argument for a TABLE parameter:

      Select * From
      TABLE(TUMBLE(
                 data =>  TABLE orders
                 ...
      )
      

      The TABLE parameter will be wrapped by a SCALAR_QUERY call at this line: https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java#L3067

      However, it is wrong because TABLE paramter is not a query that returns a scalar value.

      It cannot be solved by overriding SqlOperator.argumentMustBeScalar because named argument is a special operator that doesn't tied with other operators.

      One possible resolution is also check if operand is SqlSelect at SqlValidatorImpl.java#L3067.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              amaliujia Rui Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: