drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meh...@apache.org
Subject [1/7] drill git commit: DRILL-2491: Fix use of injectable QueryDateTimeInfo in localtimestamp function
Date Wed, 18 Mar 2015 21:18:46 GMT
Repository: drill
Updated Branches:
  refs/heads/master 3f93454f0 -> 12a7d0179


DRILL-2491: Fix use of injectable QueryDateTimeInfo in localtimestamp function


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/151b9be8
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/151b9be8
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/151b9be8

Branch: refs/heads/master
Commit: 151b9be86a7ebb43ff6a5c5538095a0c858844f0
Parents: 3f93454
Author: Mehant Baid <mehantr@gmail.com>
Authored: Tue Mar 17 18:02:03 2015 -0700
Committer: Mehant Baid <mehantr@gmail.com>
Committed: Tue Mar 17 18:02:03 2015 -0700

----------------------------------------------------------------------
 .../apache/drill/exec/expr/fn/impl/DateTypeFunctions.java |  2 +-
 .../apache/drill/exec/fn/impl/TestNewDateFunctions.java   | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/151b9be8/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
index a628afc..668c9ba 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
@@ -297,7 +297,7 @@ public class DateTypeFunctions {
 
         public void setup() {
 
-            org.joda.time.DateTime now = (new org.joda.time.DateTime(dateTime)).withZoneRetainFields(org.joda.time.DateTimeZone.UTC);
+            org.joda.time.DateTime now = (new org.joda.time.DateTime(dateTime.getQueryStartTime())).withZoneRetainFields(org.joda.time.DateTimeZone.UTC);
             queryStartDate = now.getMillis();
         }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/151b9be8/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewDateFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewDateFunctions.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewDateFunctions.java
index 6f912f8..0e9276c 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewDateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestNewDateFunctions.java
@@ -93,4 +93,14 @@ public class TestNewDateFunctions extends BaseTestQuery {
         .baselineValues(true)
         .go();
   }
+
+  @Test
+  public void testLocalTimestamp() throws Exception {
+    testBuilder()
+        .sqlQuery("select extract(day from localtimestamp) = extract(day from current_date)
as col from cp.`employee.json` limit 1")
+        .unOrdered()
+        .baselineColumns("col")
+        .baselineValues(true)
+        .go();
+  }
 }


Mime
View raw message