Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-5364

Planner inserts sort for simple constant value query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Reopened
    • Minor
    • Resolution: Unresolved
    • 1.10.0
    • None
    • None
    • None

    Description

      Consider the following query:

      SELECT CURRENT_TIMESTAMP FROM (VALUES(1))
      

      The following is the plan generated for the query. Notice the inclusion of an unnecessary sort.

        "graph" : [ {
          "pop" : "Values",
          "@id" : 4,
          "content" : [ {
            "EXPR$0" : {
              "$numberLong" : 1
            }
          } ],
          "initialAllocation" : 1000000,
          "maxAllocation" : 10000000000,
          "cost" : 1.0
        }, {
          "pop" : "project",
          "@id" : 3,
          "exprs" : [ {
            "ref" : "`CURRENT_TIMESTAMP`",
            "expr" : "current_timestamp() "
          } ],
          "child" : 4,
          "initialAllocation" : 1000000,
          "maxAllocation" : 10000000000,
          "cost" : 1.0
        }, {
          "pop" : "external-sort",
          "@id" : 2,
          "child" : 3,
          "orderings" : [ {
            "order" : "ASC",
            "expr" : "`CURRENT_TIMESTAMP`",
            "nullDirection" : "UNSPECIFIED"
          } ],
          "reverse" : false,
          "initialAllocation" : 20000000,
          "maxAllocation" : 10000000000,
          "cost" : 1.0
        }, {
          "pop" : "selection-vector-remover",
          "@id" : 1,
          "child" : 2,
          "initialAllocation" : 1000000,
          "maxAllocation" : 10000000000,
          "cost" : 1.0
        }, {
          "pop" : "screen",
          "@id" : 0,
          "child" : 1,
          "initialAllocation" : 1000000,
          "maxAllocation" : 10000000000,
          "cost" : 1.0
        } ]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            paul-rogers Paul Rogers
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: