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

Duplicate RAND() after pushdown when optimizing

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • core
    • None

    Description

      In CsvTest:

      SQL: 

      select *
      from
      (
          select empno, rand(1) as ran
          from EMPS
          where gender <> 'M'
      ) t
      where ran > 0.6
      

       

      PLAN: 

      EnumerableProject(EMPNO=[$0], RAN=[RAND(1)])
        EnumerableInterpreter
          BindableTableScan(table=[[SALES, EMPS]], filters=[[AND(<>($3, 'M'), >(RAND(1), 0.6:DECIMAL(2, 1)))]])
      

      We can see there are two "RAND(1)" and it changes the semantics.

       

       

      Attachments

        Activity

          People

            Aron.tao Jiatao Tao
            Aron.tao Jiatao Tao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: