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

SqlToRelConverter will remove the sort with offset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.39.0
    • None

    Description

      Tests in RelToSqlConverterTest:

      @Test void testSortWithOffsetInSubQuery() {
        final String sql = "select count(*) from (select * from emp order by empno offset 10)";
        sql(sql).ok();
      } 

      Plan:

      LogicalAggregate(group=[{}], EXPR$0=[COUNT()])
        LogicalProject($f0=[0])
          LogicalTableScan(table=[[CATALOG, SALES, EMP]]) 

      Sort was removed because it didn't contain fetch. In PostgreSQL, SqlServer, such a query is legal and will return the result after the offset.

      Attachments

        Issue Links

          Activity

            People

              suibianwanwan33 suibianwanwan
              suibianwanwan33 suibianwanwan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: