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

Add the planner rule that pushes the Filter past a Sample

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.36.0
    • core

    Description

      The Filter could be pushed past the Sample.

      For example:

      select deptno from "scott".dept tablesample system(50) where  deptno > 10

      The plan tree is :

       LogicalProject(o_orderkey=[$0])
        LogicalFilter(condition=[>($0, 0)])
          Sample(mode=[system], rate=[0.5], repeatableSeed=[-])
            LogicalTableScan(table=[[tpch, ORDERS]]) 

      Could be rewrite to :

        LogicalProject(o_orderkey=[$0])
          Sample(mode=[system], rate=[0.5], repeatableSeed=[-])
            LogicalFilter(condition=[>($0, 0)])      
              LogicalTableScan(table=[[tpch, ORDERS]]) 

      The same logic could see Presto/Trino: PredicatePushDown.Rewriter#visitSample

      Attachments

        Issue Links

          Activity

            People

              shenlang LakeShen
              shenlang LakeShen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: