You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/07 07:13:00 UTC

[jira] [Commented] (DRILL-3950) CAST(...) * (Interval Constant) gives Internal Exception

    [ https://issues.apache.org/jira/browse/DRILL-3950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16465531#comment-16465531 ] 

ASF GitHub Bot commented on DRILL-3950:
---------------------------------------

vvysotskyi closed pull request #218: DRILL-3950: Add test case and bump calcite version to 1.4.0-drill-r7
URL: https://github.com/apache/drill/pull/218
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCastFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCastFunctions.java
index 23fc54e5dc..1a3b7511a6 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCastFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestCastFunctions.java
@@ -18,9 +18,9 @@
 package org.apache.drill.exec.fn.impl;
 
 import org.apache.drill.BaseTestQuery;
-import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.util.FileUtils;
 import org.joda.time.DateTime;
+import org.joda.time.Period;
 import org.junit.Test;
 
 public class TestCastFunctions extends BaseTestQuery {
@@ -79,4 +79,22 @@ public void testToDateForTimeStamp() throws Exception {
         .build()
         .run();
   }
-}
\ No newline at end of file
+
+  @Test // DRILL-3950
+  public void testCastTimesInterval() throws Exception {
+    final String query = "select cast(r_regionkey as Integer) * (INTERVAL '1' DAY) as col \n" +
+        "from cp.`tpch/region.parquet`";
+
+    testBuilder()
+        .sqlQuery(query)
+        .ordered()
+        .baselineColumns("col")
+        .baselineValues(Period.days(0))
+        .baselineValues(Period.days(1))
+        .baselineValues(Period.days(2))
+        .baselineValues(Period.days(3))
+        .baselineValues(Period.days(4))
+        .build()
+        .run();
+  }
+}
diff --git a/pom.xml b/pom.xml
index 882f8d8af2..d94e21195b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1238,7 +1238,7 @@
           <dependency>
             <groupId>org.apache.calcite</groupId>
             <artifactId>calcite-core</artifactId>
-            <version>1.4.0-drill-r6</version>
+            <version>1.4.0-drill-r7</version>
             <exclusions>
               <exclusion>
                 <groupId>org.jgrapht</groupId>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> CAST(...) * (Interval Constant) gives Internal Exception
> --------------------------------------------------------
>
>                 Key: DRILL-3950
>                 URL: https://issues.apache.org/jira/browse/DRILL-3950
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning &amp; Optimization
>            Reporter: Sean Hsuan-Yi Chu
>            Assignee: Roman Kulyk
>            Priority: Major
>              Labels: interval
>
> For example,
> {code}
> select cast(empno as Integer) * (INTERVAL '1' DAY)
> from emp
> {code}
> results into
> {code}
> java.lang.AssertionError: Internal error: invalid literal: INTERVAL '1' DAY
> {code}
> The reason is that INTERVAL constant is not extracted properly in the cases where this constant times a CAST() function



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)