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

Sort in subquery is lost when converting SqlNode to Relnode

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Lost sort in subquery when converting a SqlNode to Relnode, making its semantics changed.

       The test case to reproduce

      // SqlToRelConverterTest
      @Test public void testSortInSubquery() {
          final String sql = "select ename from (select ename from emp order by ename) a";
          sql(sql).ok();
        }
      

      This test case will success with this plan.

      <TestCase name="testSortInSubquery">
              <Resource name="sql">
                  <![CDATA[select ename from (select ename from emp order by ename) a]]>
              </Resource>
              <Resource name="plan">
                  <![CDATA[
      LogicalProject(ENAME=[$1])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])
      ]]>
              </Resource>
          </TestCase>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                yanlin-Lynn Wang Yanlin
                Reporter:
                yanlin-Lynn Wang Yanlin
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: