Apache Drill
  1. Apache Drill
  2. DRILL-421

Unable to convert type DATE to a drill constant expression

    Details

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

      Description

      The following query works with postgres:
      foodmart=# select date '2013-12-31' from customer limit 1;
      date
      ------------
      2013-12-31
      (1 row)

      But failed with Drill:
      0: jdbc:drill:> select date '2013-12-31' from `customer.json` limit 1;
      Query failed: org.apache.drill.exec.rpc.RpcException: Remote failure while running query.[error_id: "2019f569-1437-4a13-9365-8bd10016f402"
      endpoint

      { address: "qa-node118.qa.lab" user_port: 31010 control_port: 31011 data_port: 31012 }

      error_type: 0
      message: "Failure while parsing sql. < UnsupportedOperationException:[ Unable to convert the value of 2013-12-31 and type DATE to a Drill constant expression. ]"
      ]
      Error: exception while executing query (state=,code=0)

      Stack trace:
      12:08:42.804 [WorkManager Event Thread] DEBUG o.apache.drill.exec.work.WorkManager - Starting pending task org.apache.drill.exec.work.foreman.Foreman@5ab0f09f
      12:08:42.817 [WorkManager-1] ERROR o.a.drill.exec.work.foreman.Foreman - Error 2019f569-1437-4a13-9365-8bd10016f402: Failure while parsing sql.
      java.lang.UnsupportedOperationException: Unable to convert the value of 2013-12-31 and type DATE to a Drill constant expression.
      at org.apache.drill.exec.planner.logical.DrillOptiq$RexToDrill.visitLiteral(DrillOptiq.java:205) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillOptiq$RexToDrill.visitLiteral(DrillOptiq.java:63) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.eigenbase.rex.RexLiteral.accept(RexLiteral.java:599) ~[optiq-core-0.4.18.jar:na]
      at org.apache.drill.exec.planner.logical.DrillOptiq.toDrill(DrillOptiq.java:60) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillProjectRel.implement(DrillProjectRel.java:81) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillImplementor.visitChild(DrillImplementor.java:74) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillLimitRel.implement(DrillLimitRel.java:52) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillImplementor.visitChild(DrillImplementor.java:74) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillScreenRel.implement(DrillScreenRel.java:72) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.logical.DrillImplementor.go(DrillImplementor.java:61) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:85) ~[drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:350) [drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:175) [drill-java-exec-1.0.0-m2-incubating-SNAPSHOT-rebuffed.jar:1.0.0-m2-incubating-SNAPSHOT]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
      at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]

        Activity

        Tony Stevenson made changes -
        Workflow no-reopen-closed, patch-avail, testing [ 12860223 ] Drill workflow [ 12934235 ]
        Jacques Nadeau made changes -
        Fix Version/s 0.4.0 [ 12324963 ]
        Jacques Nadeau made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Jake Farrell made changes -
        Field Original Value New Value
        Workflow no-reopen-closed, patch-avail [ 12848435 ] no-reopen-closed, patch-avail, testing [ 12860223 ]
        Chun Chang created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Chun Chang
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development