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

Constant condition can't be reduced after correlate

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.33.0
    • core

    Description

      Currently the RelMdPredicates do not handle the predicates for the correlate node which will generate the below output

      Sink(table=[default_catalog.default_database.sink_t], fields=[name, num])
      +- Calc(select=[name, CAST(CASE(=(__source_type__, _UTF-16LE'bounded'), 1, 2) AS BIGINT) AS num])
         +- Correlate(invocation=[test_udtf($cor1.name)], correlate=[table(test_udtf($cor1.name))], select=[name,__source_type__,EXPR$0], rowType=[RecordType(VARCHAR(2147483647) name, CHAR(7) __source_type__, VARCHAR(2147483647) EXPR$0)], joinType=[INNER])
            +- Calc(select=[name, _UTF-16LE'bounded' AS __source_type__])
               +- TableSourceScan(table=[[default_catalog, default_database, source_t]], fields=[name])
      

      However, the '_source_type_' is obviously a constant can be reduced during optimizing. It can be solved by extend the RelMdPredicates to get predicates from the left input of the correlate node

      Attachments

        Issue Links

          Activity

            People

              aitozi WenJun Min
              aitozi WenJun Min
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 1h
                  1h