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

Support SQL hint for Snapshot

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.32.0
    • None

    Description

      1. Current `snapshot` does not support hint yet and this blocks hint propagation to the underlying temporal table(As query hints, all operators included in the query may have the need to propagate hint, current hint propagation depends on whether the node is hintable).

      2. When do a temporal join in Flink, the snapshot maybe optimized in some cases (to reserve less versions of the managed versioned-table), e.g., 

      select /*+ snapshot('max-version'='1') */ stream *
      from orders o join products_temporal for system_time as of orders.proctime as p
      on o.productid = p.productid
      

      currently, the following node tree has no hint on `LogicalSnapshot`

      LogicalDelta
        LogicalProject(PROCTIME=[$0], PRODUCTID=[$1], ORDERID=[$2], PRODUCTID0=[$3], NAME=[$4], SUPPLIERID=[$5], SYS_START=[$6], SYS_END=[$7])
          LogicalFilter(condition=[=($1, $3)])
            LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[\{0}])
              LogicalTableScan(table=[[CATALOG, SALES, ORDERS]])
              LogicalSnapshot(period=[$cor0.PROCTIME])
                LogicalTableScan(table=[[CATALOG, SALES, PRODUCTS_TEMPORAL]])
      

      If snapshot could be extended to support hint, it would make this optimization possible.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lincoln.86xy lincoln lee
              Votes:
              0 Vote for this issue
              Watchers:
              8 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 - 20m
                  20m