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

Sort in subquery is lost when converting SqlNode to Relnode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: