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

        Hide
        Chun Chang added a comment -

        fixed. the extra time portion is covered in another JIRA, JIRA805.

        0: jdbc:drill:schema=dfs> select date '2013-12-31' from customer limit 1;
        ------------

        EXPR$0

        ------------

        2013-12-31T00:00:00.000-08:00

        ------------

        Show
        Chun Chang added a comment - fixed. the extra time portion is covered in another JIRA, JIRA805. 0: jdbc:drill:schema=dfs> select date '2013-12-31' from customer limit 1; ------------ EXPR$0 ------------ 2013-12-31T00:00:00.000-08:00 ------------
        Hide
        Jacques Nadeau added a comment -

        fixed in master

        Show
        Jacques Nadeau added a comment - fixed in master

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development