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

Cannot plan query that is UNION ALL applied to VALUES

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.23.0
    • Component/s: None
    • Labels:
      None

      Description

      Cannot plan query that is UNION ALL applied to VALUES. For example, in JdbcTest:

        @Test public void testUnionAllValues() {
          CalciteAssert.hr()
              .query("select x, y from (values (1, 2)) as t(x, y)\n"
                  + "union all\n"
                  + "select a + b, a - b from (values (3, 4), (5, 6)) as u(a, b)")
              .returnsUnordered();
        }
      

      gives

      java.sql.SQLException: Error while executing SQL "select x, y from (values (1, 2)) as t(x, y)
      union all
      select a + b, a - b from (values (3, 4), (5, 6)) as u(a, b)": Node [rel#26:Subset#4.ENUMERABLE.[]] could not be implemented; planner state:
      
      Root: rel#26:Subset#4.ENUMERABLE.[]
      Original rel:
      LogicalUnion(subset=[rel#26:Subset#4.ENUMERABLE.[]], all=[true]): rowcount = 3.0, cumulative cost = {3.0 rows, 3.0 cpu, 0.0 io}, id = 21
        LogicalProject(subset=[rel#17:Subset#1.NONE.[]], X=[$0], Y=[$1]): rowcount = 1.0, cumulative cost = {1.0 rows, 2.0 cpu, 0.0 io}, id = 16
          LogicalValues(subset=[rel#15:Subset#0.NONE.[]], tuples=[[{ 1, 2 }]]): rowcount = 1.0, cumulative cost = {1.0 rows, 1.0 cpu, 0.0 io}, id = 1
        LogicalProject(subset=[rel#20:Subset#3.NONE.[0]], EXPR$0=[+($0, $1)], EXPR$1=[-($0, $1)]): rowcount = 2.0, cumulative cost = {2.0 rows, 4.0 cpu, 0.0 io}, id = 19
          LogicalValues(subset=[rel#18:Subset#2.NONE.[]], tuples=[[{ 3, 4 }, { 5, 6 }]]): rowcount = 2.0, cumulative cost = {2.0 rows, 1.0 cpu, 0.0 io}, id = 4
      

        Attachments

        1. graphviz (1).svg
          20 kB
          Jin Xing

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                julianhyde Julian Hyde
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: