You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by me...@apache.org on 2015/03/18 22:18:49 UTC
[4/7] drill git commit: DRILL-2389: Remove timestamp with time zone
DRILL-2389: Remove timestamp with time zone
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/8faa6642
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/8faa6642
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/8faa6642
Branch: refs/heads/master
Commit: 8faa66424b81e4341b36c1aeecc767edbb233d38
Parents: 7a56df1
Author: Mehant Baid <me...@gmail.com>
Authored: Tue Mar 17 18:07:53 2015 -0700
Committer: Mehant Baid <me...@gmail.com>
Committed: Tue Mar 17 18:07:53 2015 -0700
----------------------------------------------------------------------
.../src/main/codegen/data/AggrTypes1.tdd | 6 --
exec/java-exec/src/main/codegen/data/Casts.tdd | 6 --
.../main/codegen/data/ComparisonTypesMain.tdd | 1 -
.../src/main/codegen/data/DateIntervalFunc.tdd | 2 +-
.../src/main/codegen/data/ExtractTypes.tdd | 2 +-
.../src/main/codegen/data/ValueVectorTypes.tdd | 1 -
.../main/codegen/templates/CastDateDate.java | 6 +-
.../main/codegen/templates/CastDateVarChar.java | 6 +-
.../main/codegen/templates/CastVarCharDate.java | 8 +--
.../templates/ConvertToNullableHolder.java | 5 +-
.../templates/DateIntervalAggrFunctions1.java | 14 +---
.../DateDateArithmeticFunctions.java | 10 ---
.../DateIntervalArithmeticFunctions.java | 22 +-----
.../DateToCharFunctions.java | 3 -
.../DateTruncFunctions.java | 4 +-
.../DateIntervalFunctionTemplates/Extract.java | 6 +-
.../ToDateTypeFunctions.java | 4 --
.../codegen/templates/FixedValueVectors.java | 52 +-------------
.../templates/JsonOutputRecordWriter.java | 1 -
.../codegen/templates/NullableValueVectors.java | 2 +-
.../templates/ParquetOutputRecordWriter.java | 1 -
.../codegen/templates/ParquetTypeHelper.java | 1 -
.../main/codegen/templates/SqlAccessors.java | 13 +---
.../templates/StringOutputRecordWriter.java | 1 -
.../src/main/codegen/templates/TypeHelper.java | 2 +-
.../bytecode/ScalarReplacementTypes.java | 4 --
.../expr/fn/impl/CastBigIntTimeStampTZ.java | 53 --------------
.../exec/expr/fn/impl/DateTypeFunctions.java | 75 +-------------------
.../drill/exec/expr/fn/impl/HashFunctions.java | 32 ---------
.../drill/exec/fn/impl/TestDateFunctions.java | 4 +-
.../fn/interp/ExpressionInterpreterTest.java | 7 +-
.../drill/exec/record/vector/TestDateTypes.java | 1 -
.../date/date_difference_arithmetic.json | 1 -
.../test/resources/functions/date/to_char.json | 3 +-
.../record/vector/test_all_date_literals.json | 1 -
.../apache/drill/jdbc/test/TestJdbcQuery.java | 3 +-
36 files changed, 25 insertions(+), 338 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd b/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
index 45d30a2..8952417 100644
--- a/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
+++ b/exec/java-exec/src/main/codegen/data/AggrTypes1.tdd
@@ -31,8 +31,6 @@
{inputType: "NullableDate", outputType: "Date", runningType: "Date", major: "Date", initialValue: "Long.MAX_VALUE"},
{inputType: "TimeStamp", outputType: "TimeStamp", runningType: "TimeStamp", major: "Date", initialValue: "Long.MAX_VALUE"},
{inputType: "NullableTimeStamp", outputType: "TimeStamp", runningType: "TimeStamp", major: "Date", initialValue: "Long.MAX_VALUE"},
- {inputType: "TimeStampTZ", outputType: "TimeStampTZ", runningType: "TimeStampTZ", major: "Date", initialValue: "Long.MAX_VALUE"},
- {inputType: "NullableTimeStampTZ", outputType: "TimeStampTZ", runningType: "TimeStampTZ", major: "Date", initialValue: "Long.MAX_VALUE"},
{inputType: "Time", outputType: "Time", runningType: "Time", major: "Date", initialValue: "Integer.MAX_VALUE"},
{inputType: "NullableTime", outputType: "Time", runningType: "Time", major: "Date", initialValue: "Integer.MAX_VALUE"},
{inputType: "IntervalDay", outputType: "IntervalDay", runningType: "BigInt", major: "Date", initialValue: "Long.MAX_VALUE"},
@@ -60,8 +58,6 @@
{inputType: "NullableDate", outputType: "Date", runningType: "Date", major: "Date", initialValue: "Long.MIN_VALUE"},
{inputType: "TimeStamp", outputType: "TimeStamp", runningType: "TimeStamp", major: "Date", initialValue: "Long.MIN_VALUE"},
{inputType: "NullableTimeStamp", outputType: "TimeStamp", runningType: "TimeStamp", major: "Date", initialValue: "Long.MIN_VALUE"},
- {inputType: "TimeStampTZ", outputType: "TimeStampTZ", runningType: "TimeStampTZ", major: "Date", initialValue: "Long.MIN_VALUE"},
- {inputType: "NullableTimeStampTZ", outputType: "TimeStampTZ", runningType: "TimeStampTZ", major: "Date", initialValue: "Long.MIN_VALUE"},
{inputType: "Time", outputType: "Time", runningType: "Time", major: "Date", initialValue: "Integer.MIN_VALUE"},
{inputType: "NullableTime", outputType: "Time", runningType: "Time", major: "Date", initialValue: "Integer.MIN_VALUE"},
{inputType: "IntervalDay", outputType: "IntervalDay", runningType: "BigInt", major: "Date", initialValue: "Long.MIN_VALUE"},
@@ -108,8 +104,6 @@
{inputType: "NullableDate", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
{inputType: "TimeStamp", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
{inputType: "NullableTimeStamp", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
- {inputType: "TimeStampTZ", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
- {inputType: "NullableTimeStampTZ", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
{inputType: "Time", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
{inputType: "NullableTime", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
{inputType: "IntervalDay", outputType: "BigInt", runningType: "BigInt", major: "Date", initialValue: "0"},
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/Casts.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/Casts.tdd b/exec/java-exec/src/main/codegen/data/Casts.tdd
index 6fe7404..7d4914c 100644
--- a/exec/java-exec/src/main/codegen/data/Casts.tdd
+++ b/exec/java-exec/src/main/codegen/data/Casts.tdd
@@ -55,15 +55,10 @@
{from: "VarBinary", to: "VarBinary", major: "SrcVarlenTargetVarlen"},
{from: "Date", to: "TimeStamp", major: "Date"},
- {from: "Date", to: "TimeStampTZ", major: "Date"},
{from: "TimeStamp", to: "Date", major: "Date"},
- {from: "TimeStamp", to: "TimeStampTZ", major: "Date"},
- {from: "TimeStampTZ", to: "Date", major: "Date"},
- {from: "TimeStampTZ", to: "TimeStamp", major: "Date"},
{from: "VarChar", to: "Date", major: "VarCharDate", alias: "datetype"},
{from: "VarChar", to: "TimeStamp", major: "VarCharDate", alias: "timestamptype"},
- {from: "VarChar", to: "TimeStampTZ", major: "VarCharDate", alias: "timestamptztype"},
{from: "VarChar", to: "Time", major: "VarCharDate", alias: "timetype"},
{from: "VarBinary", to: "Date", major: "VarBinaryDate", alias: "datetype"},
@@ -73,7 +68,6 @@
{from: "Date", to: "VarChar", major: "DateVarChar", bufferLength: "10"}
{from: "TimeStamp", to: "VarChar", major: "DateVarChar", bufferLength: "23"},
{from: "Time", to: "VarChar", major: "DateVarChar", bufferLength: "12"},
- {from: "TimeStampTZ", to: "VarChar", major: "DateVarChar", bufferLength: "54"},
{from: "VarChar", to: "Interval", major: "VarCharInterval"},
{from: "VarChar", to: "IntervalDay", major: "VarCharInterval"},
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/ComparisonTypesMain.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/ComparisonTypesMain.tdd b/exec/java-exec/src/main/codegen/data/ComparisonTypesMain.tdd
index c4d924c..d5d3f30 100644
--- a/exec/java-exec/src/main/codegen/data/ComparisonTypesMain.tdd
+++ b/exec/java-exec/src/main/codegen/data/ComparisonTypesMain.tdd
@@ -50,7 +50,6 @@
{comparables: ["TimeStamp"], mode: "primitive"},
{comparables: ["Date"], mode: "primitive"},
{comparables: ["Time"], mode: "primitive"},
- {comparables: ["TimeStampTZ"], mode: "primitive"},
{comparables: ["IntervalYear"], mode: "primitive"},
{comparables: ["IntervalDay"], mode: "intervalDay"},
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/DateIntervalFunc.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/DateIntervalFunc.tdd b/exec/java-exec/src/main/codegen/data/DateIntervalFunc.tdd
index ea295b3..8b842c3 100644
--- a/exec/java-exec/src/main/codegen/data/DateIntervalFunc.tdd
+++ b/exec/java-exec/src/main/codegen/data/DateIntervalFunc.tdd
@@ -14,6 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{
- {dates: ["Date", "TimeStamp", "Time", "TimeStampTZ"] },
+ {dates: ["Date", "TimeStamp", "Time"] },
{intervals: ["Interval", "IntervalDay", "IntervalYear", "Int", "BigInt"] }
}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/ExtractTypes.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/ExtractTypes.tdd b/exec/java-exec/src/main/codegen/data/ExtractTypes.tdd
index 594f78f..70d7861 100644
--- a/exec/java-exec/src/main/codegen/data/ExtractTypes.tdd
+++ b/exec/java-exec/src/main/codegen/data/ExtractTypes.tdd
@@ -16,5 +16,5 @@
{
toTypes: [Second, Minute, Hour, Day, Month, Year],
- fromTypes: [Date, Time, TimeStamp, TimeStampTZ, Interval, IntervalDay, IntervalYear]
+ fromTypes: [Date, Time, TimeStamp, Interval, IntervalDay, IntervalYear]
}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd b/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
index 813f43a..3f69e25 100644
--- a/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
+++ b/exec/java-exec/src/main/codegen/data/ValueVectorTypes.tdd
@@ -90,7 +90,6 @@
javaType: "DrillBuf",
boxedType: "DrillBuf",
minor: [
- { class: "TimeStampTZ", millisecondsSize: 8, friendlyType: "DateTime", fields: [ {name: "value", type:"long"}, {name: "index", type: "int"}] },
{ class: "IntervalDay", millisecondsOffset: 4, friendlyType: "Period", fields: [ {name: "days", type:"int"}, {name: "milliseconds", type:"int"}] }
]
},
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/CastDateDate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/CastDateDate.java b/exec/java-exec/src/main/codegen/templates/CastDateDate.java
index 4a72297..1cd0b5a 100644
--- a/exec/java-exec/src/main/codegen/templates/CastDateDate.java
+++ b/exec/java-exec/src/main/codegen/templates/CastDateDate.java
@@ -18,7 +18,7 @@
<@pp.dropOutputFile />
<#list cast.types as type>
-<#if type.major == "Date"> <#-- Template file to convert between Date types (Date, TimeStamp, TimeStampTZ) -->
+<#if type.major == "Date"> <#-- Template file to convert between Date types (Date, TimeStamp) -->
<@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/gcast/Cast${type.from}To${type.to}.java" />
@@ -56,10 +56,6 @@ public class Cast${type.from}To${type.to} implements DrillSimpleFunc {
out.value = (new org.joda.time.DateMidnight(in.value, org.joda.time.DateTimeZone.UTC)).getMillis();
<#elseif type.to == "TimeStamp">
out.value = in.value;
- <#elseif type.to == "TimeStampTZ">
- out.value = in.value;
- // While casting from other date formats, we always use UTC as the timezone
- out.index = org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneMap.get("UTC");
</#if>
}
}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/CastDateVarChar.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/CastDateVarChar.java b/exec/java-exec/src/main/codegen/templates/CastDateVarChar.java
index 570f367..0c31b96 100644
--- a/exec/java-exec/src/main/codegen/templates/CastDateVarChar.java
+++ b/exec/java-exec/src/main/codegen/templates/CastDateVarChar.java
@@ -20,7 +20,7 @@
<#list cast.types as type>
-<#if type.major == "DateVarChar"> <#-- Template to convert functions from Date, Time, TimeStamp, TimeStampTZ to VarChar -->
+<#if type.major == "DateVarChar"> <#-- Template to convert functions from Date, Time, TimeStamp to VarChar -->
<@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/gcast/Cast${type.from}To${type.to}.java" />
@@ -67,11 +67,7 @@ public class Cast${type.from}To${type.to} implements DrillSimpleFunc {
org.joda.time.LocalTime temp = new org.joda.time.LocalTime(in.value, org.joda.time.DateTimeZone.UTC);
String str = temp.toString();
<#else>
- <#if type.from == "TimeStampTZ">
- org.joda.time.MutableDateTime temp = new org.joda.time.MutableDateTime(in.value, org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[in.index]));
- <#else>
org.joda.time.MutableDateTime temp = new org.joda.time.MutableDateTime(in.value, org.joda.time.DateTimeZone.UTC);
- </#if>
String str = org.apache.drill.exec.expr.fn.impl.DateUtility.format${type.from}.print(temp);
</#if>
out.buffer = buffer;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/CastVarCharDate.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/CastVarCharDate.java b/exec/java-exec/src/main/codegen/templates/CastVarCharDate.java
index b6c5612..68f9b8c 100644
--- a/exec/java-exec/src/main/codegen/templates/CastVarCharDate.java
+++ b/exec/java-exec/src/main/codegen/templates/CastVarCharDate.java
@@ -18,7 +18,7 @@
<@pp.dropOutputFile />
<#list cast.types as type>
-<#if type.major == "VarCharDate" || type.major == "VarBinaryDate"> <#-- Template to convert from VarChar/ VarBinary to Date, Time, TimeStamp, TimeStampTZ -->
+<#if type.major == "VarCharDate" || type.major == "VarBinaryDate"> <#-- Template to convert from VarChar/ VarBinary to Date, Time, TimeStamp -->
<@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/gcast/Cast${type.from}To${type.to}.java" />
@@ -69,12 +69,6 @@ public class Cast${type.from}To${type.to} implements DrillSimpleFunc {
org.joda.time.format.DateTimeFormatter f = org.apache.drill.exec.expr.fn.impl.DateUtility.getDateTimeFormatter();
out.value = org.joda.time.DateTime.parse(input, f).withZoneRetainFields(org.joda.time.DateTimeZone.UTC).getMillis();
- <#elseif type.to == "TimeStampTZ">
- org.joda.time.format.DateTimeFormatter f = org.apache.drill.exec.expr.fn.impl.DateUtility.getDateTimeFormatter();
- org.joda.time.DateTime dt = org.joda.time.DateTime.parse(input, f);
- out.value = dt.getMillis();
- out.index = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(dt.getZone().toString());
-
<#elseif type.to == "Time">
org.joda.time.format.DateTimeFormatter f = org.apache.drill.exec.expr.fn.impl.DateUtility.getTimeFormatter();
out.value = (int) ((f.parseDateTime(input)).withZoneRetainFields(org.joda.time.DateTimeZone.UTC).getMillis());
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/ConvertToNullableHolder.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ConvertToNullableHolder.java b/exec/java-exec/src/main/codegen/templates/ConvertToNullableHolder.java
index 68595fc..045c919 100644
--- a/exec/java-exec/src/main/codegen/templates/ConvertToNullableHolder.java
+++ b/exec/java-exec/src/main/codegen/templates/ConvertToNullableHolder.java
@@ -47,10 +47,7 @@ public class ${className} implements DrillSimpleFunc {
public void eval() {
output.isSet = 1;
<#if type.major != "VarLen">
- <#if (minor.class == "TimeStampTZ")>
- output.value = input.value;
- output.index = input.index;
- <#elseif (minor.class == "Interval")>
+ <#if (minor.class == "Interval")>
output.months = input.months;
output.days = input.days;
output.milliseconds = input.milliseconds;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalAggrFunctions1.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalAggrFunctions1.java b/exec/java-exec/src/main/codegen/templates/DateIntervalAggrFunctions1.java
index 56e37ce..e934167 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalAggrFunctions1.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalAggrFunctions1.java
@@ -80,12 +80,7 @@ public static class ${type.inputType}${aggrtype.className} implements DrillAggFu
<#if aggrtype.funcName == "min">
- <#if type.outputType == "TimeStampTZ">
- if (in.value < value.value) {
- value.value = in.value;
- value.index = in.index;
- }
- <#elseif type.outputType == "Interval">
+ <#if type.outputType == "Interval">
long inMS = (long) in.months * org.apache.drill.exec.expr.fn.impl.DateUtility.monthsToMillis+
in.days * (org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis) +
@@ -104,12 +99,7 @@ public static class ${type.inputType}${aggrtype.className} implements DrillAggFu
value.value = Math.min(value.value, in.value);
</#if>
<#elseif aggrtype.funcName == "max">
- <#if type.outputType == "TimeStampTZ">
- if (in.value < value.value) {
- value.value = in.value;
- value.index = in.index;
- }
- <#elseif type.outputType == "Interval">
+ <#if type.outputType == "Interval">
long inMS = (long) in.months * org.apache.drill.exec.expr.fn.impl.DateUtility.monthsToMillis+
in.days * (org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis) +
in.milliseconds;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateDateArithmeticFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateDateArithmeticFunctions.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateDateArithmeticFunctions.java
index a550a69..5fb2136 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateDateArithmeticFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateDateArithmeticFunctions.java
@@ -62,16 +62,6 @@ public static class G${type}Difference implements DrillSimpleFunc {
long difference = (left.value - right.value);
out.milliseconds = (int) (difference % org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis);
out.days = (int) (difference / org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis);
- <#elseif type == "TimeStampTZ">
- if (left.index != right.index) {
- // The two inputs are in different time zones convert one of them
- org.joda.time.DateTime leftInput = new org.joda.time.DateTime(left.value, org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[left.index]));
- // convert left timestamp to the time zone of the right timestamp
- left.value = (leftInput.withZone(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[right.index]))).getMillis();
- }
- long difference = (left.value - right.value);
- out.milliseconds = (int) (difference % org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis);
- out.days = (int) (difference / org.apache.drill.exec.expr.fn.impl.DateUtility.daysToStandardMillis);
</#if>
}
}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateIntervalArithmeticFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateIntervalArithmeticFunctions.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateIntervalArithmeticFunctions.java
index 87470d5..50d869e 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateIntervalArithmeticFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateIntervalArithmeticFunctions.java
@@ -21,7 +21,7 @@
<#list dateIntervalFunc.dates as datetype>
<#list dateIntervalFunc.intervals as intervaltype>
-<#if datetype == "Date" || datetype == "TimeStamp" || datetype == "TimeStampTZ">
+<#if datetype == "Date" || datetype == "TimeStamp">
<@pp.changeOutputFile name="/org/apache/drill/exec/expr/fn/impl/${datetype}${intervaltype}Functions.java" />
<#include "/@includes/license.ftl" />
@@ -49,7 +49,7 @@ public class ${datetype}${intervaltype}Functions {
<#macro dateIntervalArithmeticBlock left right temp op output intervaltype datetype>
<#-- Throw exception if we are adding integer to a TIMESTAMP -->
- <#if (datetype == "TimeStamp" || datetype == "TimeStampTZ") && (intervaltype == "Int" || intervaltype == "BigInt")>
+ <#if (datetype == "TimeStamp") && (intervaltype == "Int" || intervaltype == "BigInt")>
if (1 == 1) {
/* Since this will be included in the run time generated code, there might be other logic that follows this
* if the exception is raised without a condition, we will hit compilation issues while compiling run time code
@@ -73,11 +73,6 @@ public class ${datetype}${intervaltype}Functions {
${temp}.addDays((int) ${right}.value <#if op == '-'> * -1 </#if>);
</#if>
- <#-- copy the time zone index if its a timestamp -->
- <#if datetype == "TimeStampTZ">
- ${output}.index = ${left}.index;
- </#if>
-
${output}.value = ${temp}.getMillis();
</#if>
</#macro>
@@ -93,13 +88,8 @@ public class ${datetype}${intervaltype}Functions {
<#else>
@Output ${datetype}Holder out;
</#if>
-
public void setup() {
- <#if datetype == "TimeStampTZ">
- temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[left.index]));
- <#else>
temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.UTC);
- </#if>
}
public void eval() {
@@ -121,11 +111,7 @@ public class ${datetype}${intervaltype}Functions {
@Output ${datetype}Holder out;
</#if>
public void setup() {
- <#if datetype == "TimeStampTZ">
- temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[left.index]));
- <#else>
temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.UTC);
- </#if>
}
public void eval() {
@@ -143,11 +129,7 @@ public class ${datetype}${intervaltype}Functions {
@Output ${datetype}Holder out;
public void setup() {
- <#if datetype == "TimeStampTZ">
- temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[left.index]));
- <#else>
temp = new org.joda.time.MutableDateTime(org.joda.time.DateTimeZone.UTC);
- </#if>
}
public void eval() {
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateToCharFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateToCharFunctions.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateToCharFunctions.java
index 4cf63dc..22c14de 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateToCharFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateToCharFunctions.java
@@ -66,9 +66,6 @@ public class G${type}ToChar implements DrillSimpleFunc {
public void eval() {
temp.setMillis(left.value);
- <#if type == "TimeStampTZ">
- temp.setZoneRetainFields(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[left.index]));
- </#if>
// print current value in the desired format
String str = format.print(temp);
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateTruncFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateTruncFunctions.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateTruncFunctions.java
index 4c60c25..5ffff24 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateTruncFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/DateTruncFunctions.java
@@ -68,8 +68,8 @@ public static class G${type}DateTrunc implements DrillSimpleFunc {
else if (org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(left.start, left.end, left.buffer).equalsIgnoreCase("SECOND")) dateTime.setRounding(dateTime.getChronology().secondOfMinute());
else
</#if>
- <#if type == "TimeStamp" || type == "TimeStampTZ">
- throw new UnsupportedOperationException("date_trunc function supports the following time units for TimeStamp(TZ): YEAR, MONTH, DAY, HOUR, MINUTE, SECOND");
+ <#if type == "TimeStamp">
+ throw new UnsupportedOperationException("date_trunc function supports the following time units for TimeStamp: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND");
out.value = dateTime.getMillis();
<#elseif type == "Date">
throw new UnsupportedOperationException("date_trunc function supports the following time units for Date: YEAR, MONTH, DAY");
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/Extract.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/Extract.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/Extract.java
index 857fece..e205247 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/Extract.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/Extract.java
@@ -33,7 +33,7 @@ public class ${className} {
<#list extract.fromTypes as fromUnit>
<#list extract.toTypes as toUnit>
-<#if fromUnit == "Date" || fromUnit == "Time" || fromUnit == "TimeStamp" || fromUnit == "TimeStampTZ">
+<#if fromUnit == "Date" || fromUnit == "Time" || fromUnit == "TimeStamp">
<#if !(fromUnit == "Time" && (toUnit == "Year" || toUnit == "Month" || toUnit == "Day"))>
@FunctionTemplate(name = "extract${toUnit}", scope = FunctionTemplate.FunctionScope.SIMPLE,
nulls = FunctionTemplate.NullHandling.NULL_IF_NULL)
@@ -54,10 +54,6 @@ public class ${className} {
public void eval() {
dateTime.setMillis(in.value);
- <#if fromUnit == "TimeStampTZ">
- dateTime.setZoneRetainFields(org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.timezoneList[in.index]));
- </#if>
-
<#if toUnit == "Second">
out.value = dateTime.getSecondOfMinute();
out.value += ((double) dateTime.getMillisOfSecond()) / 1000;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/ToDateTypeFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/ToDateTypeFunctions.java b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/ToDateTypeFunctions.java
index baba963..c2e5a37 100644
--- a/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/ToDateTypeFunctions.java
+++ b/exec/java-exec/src/main/codegen/templates/DateIntervalFunctionTemplates/ToDateTypeFunctions.java
@@ -65,10 +65,6 @@ public class GTo${type} implements DrillSimpleFunc {
out.value = (org.joda.time.DateMidnight.parse(input, format).withZoneRetainFields(org.joda.time.DateTimeZone.UTC)).getMillis();
<#elseif type == "TimeStamp">
out.value = org.joda.time.DateTime.parse(input, format).withZoneRetainFields(org.joda.time.DateTimeZone.UTC).getMillis();
- <#elseif type == "TimeStampTZ">
- org.joda.time.DateTime dt = org.joda.time.DateTime.parse(input, format);
- out.value = dt.getMillis();
- out.index = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(dt.getZone().toString());
<#elseif type == "Time">
out.value = (int) ((format.parseDateTime(input)).withZoneRetainFields(org.joda.time.DateTimeZone.UTC).getMillis());
</#if>
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
index 6cea8c8..b922767 100644
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
@@ -260,26 +260,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
return data.slice(index * ${type.width}, ${type.width});
}
- <#if (minor.class == "TimeStampTZ")>
- public void get(int index, ${minor.class}Holder holder){
- holder.value = data.getLong(index * ${type.width});
- holder.index = data.getInt((index * ${type.width})+ ${minor.millisecondsSize});
- }
-
- public void get(int index, Nullable${minor.class}Holder holder){
- holder.isSet = 1;
- holder.value = data.getLong(index * ${type.width});
- holder.index = data.getInt((index * ${type.width})+ ${minor.millisecondsSize});
- }
-
- @Override
- public ${friendlyType} getObject(int index) {
- long l = data.getLong(index * ${type.width});
- DateTime t = new DateTime(l);
- return t;
- }
-
- <#elseif (minor.class == "Interval")>
+ <#if (minor.class == "Interval")>
public void get(int index, ${minor.class}Holder holder){
int offsetIndex = index * ${type.width};
@@ -566,36 +547,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements F
data.setBytes(index * ${type.width}, value, 0, ${type.width});
}
- <#if (minor.class == "TimeStampTZ")>
- public void set(int index, long timestamp, int tzindex){
- data.setLong((index * ${type.width}), timestamp);
- data.setInt(((index * ${type.width}) + ${minor.millisecondsSize}), tzindex);
- }
-
- public void set(int index, ${minor.class}Holder holder){
- set(index, holder.value, holder.index);
- }
-
- public void set(int index, Nullable${minor.class}Holder holder){
- set(index, holder.value, holder.index);
- }
-
- public void setSafe(int index, long timestamp, int tzindex){
- if(index >= getValueCapacity()) {
- reAlloc();
- }
- set(index, timestamp, tzindex);
- }
-
- public void setSafe(int index, ${minor.class}Holder holder){
- setSafe(index, holder.value, holder.index);
- }
-
- public void setSafe(int index, Nullable${minor.class}Holder holder){
- setSafe(index, holder.value, holder.index);
- }
-
- <#elseif (minor.class == "Interval")>
+ <#if (minor.class == "Interval")>
public void set(int index, int months, int days, int milliseconds){
int offsetIndex = index * ${type.width};
data.setInt(offsetIndex, months);
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/JsonOutputRecordWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/JsonOutputRecordWriter.java b/exec/java-exec/src/main/codegen/templates/JsonOutputRecordWriter.java
index f0ddde2..1d0dc9d 100644
--- a/exec/java-exec/src/main/codegen/templates/JsonOutputRecordWriter.java
+++ b/exec/java-exec/src/main/codegen/templates/JsonOutputRecordWriter.java
@@ -132,7 +132,6 @@ public abstract class JSONOutputRecordWriter extends AbstractRecordWriter implem
minor.class == "Time" ||
minor.class == "TimeStamp" ||
minor.class == "TimeTZ" ||
- minor.class == "TimeStampTZ" ||
minor.class == "IntervalDay" ||
minor.class == "Interval" ||
minor.class == "VarChar" ||
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index 1618a99..2ec7492 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -588,7 +588,7 @@ public final class ${className} extends BaseValueVector implements <#if type.maj
<#if type.major == "VarLen">lastSet = index;</#if>
}
- <#if !(type.major == "VarLen" || minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse" || minor.class == "Decimal28Dense" || minor.class == "Decimal38Dense" || minor.class == "TimeStampTZ" || minor.class == "Interval" || minor.class == "IntervalDay")>
+ <#if !(type.major == "VarLen" || minor.class == "Decimal28Sparse" || minor.class == "Decimal38Sparse" || minor.class == "Decimal28Dense" || minor.class == "Decimal38Dense" || minor.class == "Interval" || minor.class == "IntervalDay")>
public void setSafe(int index, ${minor.javaType!type.javaType} value) {
<#if type.major == "VarLen">
fillEmpties(index);
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/ParquetOutputRecordWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ParquetOutputRecordWriter.java b/exec/java-exec/src/main/codegen/templates/ParquetOutputRecordWriter.java
index 80f3633..0d24041 100644
--- a/exec/java-exec/src/main/codegen/templates/ParquetOutputRecordWriter.java
+++ b/exec/java-exec/src/main/codegen/templates/ParquetOutputRecordWriter.java
@@ -203,7 +203,6 @@ public abstract class ParquetOutputRecordWriter extends AbstractRecordWriter imp
</#if>
<#elseif
minor.class == "TimeTZ" ||
- minor.class == "TimeStampTZ" ||
minor.class == "IntervalDay" ||
minor.class == "Interval" ||
minor.class == "Decimal28Dense" ||
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/ParquetTypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/ParquetTypeHelper.java b/exec/java-exec/src/main/codegen/templates/ParquetTypeHelper.java
index 5dbc860..6ac488d 100644
--- a/exec/java-exec/src/main/codegen/templates/ParquetTypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/ParquetTypeHelper.java
@@ -76,7 +76,6 @@ public class ParquetTypeHelper {
typeMap.put(MinorType.${minor.class?upper_case}, PrimitiveTypeName.BOOLEAN);
<#elseif
minor.class == "TimeTZ" ||
- minor.class == "TimeStampTZ" ||
minor.class == "IntervalDay" ||
minor.class == "Interval" ||
minor.class == "Decimal28Dense" ||
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/SqlAccessors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/SqlAccessors.java b/exec/java-exec/src/main/codegen/templates/SqlAccessors.java
index b569185..3039e5c 100644
--- a/exec/java-exec/src/main/codegen/templates/SqlAccessors.java
+++ b/exec/java-exec/src/main/codegen/templates/SqlAccessors.java
@@ -45,7 +45,7 @@ public class ${name}Accessor extends AbstractSqlAccessor{
this.ac = vector.getAccessor();
}
- <#if minor.class != "TimeStampTZ" && minor.class != "TimeStamp" && minor.class != "Time" && minor.class != "Date">
+ <#if minor.class != "TimeStamp" && minor.class != "Time" && minor.class != "Date">
public Object getObject(int index){
return ac.getObject(index);
}
@@ -103,16 +103,7 @@ public class ${name}Accessor extends AbstractSqlAccessor{
</#switch>
<#else>
- <#if minor.class == "TimeStampTZ">
- public Object getObject(int index) {
- return getTimestamp(index);
- }
-
- @Override
- public Timestamp getTimestamp(int index) {
- return new Timestamp(ac.getObject(index).getMillis());
- }
- <#elseif minor.class == "Interval" || minor.class == "IntervalDay" || minor.class == "IntervalYear">
+ <#if minor.class == "Interval" || minor.class == "IntervalDay" || minor.class == "IntervalYear">
@Override
public String getString(int index) {
return String.valueOf(ac.getAsStringBuilder(index));
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/StringOutputRecordWriter.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/StringOutputRecordWriter.java b/exec/java-exec/src/main/codegen/templates/StringOutputRecordWriter.java
index 070ed7b..f704cca 100644
--- a/exec/java-exec/src/main/codegen/templates/StringOutputRecordWriter.java
+++ b/exec/java-exec/src/main/codegen/templates/StringOutputRecordWriter.java
@@ -127,7 +127,6 @@ public abstract class StringOutputRecordWriter implements RecordWriter {
minor.class == "Time" ||
minor.class == "TimeTZ" ||
minor.class == "TimeStamp" ||
- minor.class == "TimeStampTZ" ||
minor.class == "IntervalYear" ||
minor.class == "IntervalDay" ||
minor.class == "Interval" ||
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/codegen/templates/TypeHelper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/TypeHelper.java b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
index ba5372f..d387b74 100644
--- a/exec/java-exec/src/main/codegen/templates/TypeHelper.java
+++ b/exec/java-exec/src/main/codegen/templates/TypeHelper.java
@@ -308,7 +308,7 @@ public class TypeHelper {
<#list vv.types as type>
<#list type.minor as minor>
case ${minor.class?upper_case} :
- <#if minor.class?starts_with("Var") || minor.class == "TimeStampTZ" || minor.class == "IntervalDay" || minor.class == "Interval" ||
+ <#if minor.class?starts_with("Var") || minor.class == "IntervalDay" || minor.class == "Interval" ||
minor.class?starts_with("Decimal28") || minor.class?starts_with("Decimal38")>
switch (type.getMode()) {
case REQUIRED:
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ScalarReplacementTypes.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ScalarReplacementTypes.java b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ScalarReplacementTypes.java
index 93f4e0d..b52eb0c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ScalarReplacementTypes.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/compile/bytecode/ScalarReplacementTypes.java
@@ -49,12 +49,10 @@ import org.apache.drill.exec.expr.holders.NullableIntervalHolder;
import org.apache.drill.exec.expr.holders.NullableIntervalYearHolder;
import org.apache.drill.exec.expr.holders.NullableTimeHolder;
import org.apache.drill.exec.expr.holders.NullableTimeStampHolder;
-import org.apache.drill.exec.expr.holders.NullableTimeStampTZHolder;
import org.apache.drill.exec.expr.holders.NullableVarBinaryHolder;
import org.apache.drill.exec.expr.holders.NullableVarCharHolder;
import org.apache.drill.exec.expr.holders.TimeHolder;
import org.apache.drill.exec.expr.holders.TimeStampHolder;
-import org.apache.drill.exec.expr.holders.TimeStampTZHolder;
import org.apache.drill.exec.expr.holders.VarBinaryHolder;
import org.apache.drill.exec.expr.holders.VarCharHolder;
@@ -87,7 +85,6 @@ public class ScalarReplacementTypes {
DateHolder.class,
TimeHolder.class,
TimeStampHolder.class,
- TimeStampTZHolder.class,
VarCharHolder.class,
VarBinaryHolder.class,
NullableBitHolder.class,
@@ -109,7 +106,6 @@ public class ScalarReplacementTypes {
NullableDateHolder.class,
NullableTimeHolder.class,
NullableTimeStampHolder.class,
- NullableTimeStampTZHolder.class
};
CLASSES = ImmutableSet.copyOf(classList);
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java
deleted file mode 100644
index d8ba5f4..0000000
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/CastBigIntTimeStampTZ.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.drill.exec.expr.fn.impl;
-
-import org.apache.drill.exec.expr.DrillSimpleFunc;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate;
-import org.apache.drill.exec.expr.annotations.FunctionTemplate.NullHandling;
-import org.apache.drill.exec.expr.annotations.Output;
-import org.apache.drill.exec.expr.annotations.Param;
-import org.apache.drill.exec.expr.annotations.Workspace;
-import org.apache.drill.exec.expr.holders.BigIntHolder;
-import org.apache.drill.exec.expr.holders.TimeStampTZHolder;
-
-@SuppressWarnings("unused")
-@FunctionTemplate(names = {"castTIMESTAMPTZ", "to_timestamptz"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls= NullHandling.NULL_IF_NULL)
-public class CastBigIntTimeStampTZ implements DrillSimpleFunc {
-
- @Param
- BigIntHolder in;
- @Workspace
- int timeZoneIndex;
- @Output
- TimeStampTZHolder out;
-
- @Override
- public void setup() {
- org.joda.time.DateTime temp = new org.joda.time.DateTime();
-
- // Store the local time zone index
- timeZoneIndex = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(temp.getZone().toString());
- }
-
- @Override
- public void eval() {
- out.value = in.value;
- out.index = timeZoneIndex;
- }
-}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/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 668c9ba..9c932d6 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
@@ -35,7 +35,6 @@ import org.apache.drill.exec.expr.holders.IntervalHolder;
import org.apache.drill.exec.expr.holders.IntervalYearHolder;
import org.apache.drill.exec.expr.holders.TimeHolder;
import org.apache.drill.exec.expr.holders.TimeStampHolder;
-import org.apache.drill.exec.expr.holders.TimeStampTZHolder;
import org.apache.drill.exec.expr.holders.VarCharHolder;
import org.apache.drill.exec.ops.QueryDateTimeInfo;
@@ -158,38 +157,6 @@ public class DateTypeFunctions {
}
}
- @FunctionTemplate(name = "timestamptztype", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
- public static class TimeStampTZType implements DrillSimpleFunc {
-
- @Param BigIntHolder inputYears;
- @Param BigIntHolder inputMonths;
- @Param BigIntHolder inputDays;
- @Param BigIntHolder inputHours;
- @Param BigIntHolder inputMinutes;
- @Param BigIntHolder inputSeconds;
- @Param BigIntHolder inputMilliSeconds;
- @Param VarCharHolder inputTimeZone;
- @Output TimeStampTZHolder out;
-
- public void setup() {
- }
-
- public void eval() {
-
- String timeZone = (org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(inputTimeZone.start, inputTimeZone.end, inputTimeZone.buffer));
- out.value = ((new org.joda.time.MutableDateTime((int)inputYears.value,
- (int)inputMonths.value,
- (int)inputDays.value,
- (int)inputHours.value,
- (int)inputMinutes.value,
- (int)inputSeconds.value,
- (int)inputMilliSeconds.value,
- org.joda.time.DateTimeZone.forID(timeZone)))).getMillis();
-
- out.index = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(timeZone);
- }
- }
-
@FunctionTemplate(name = "timetype", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
public static class TimeType implements DrillSimpleFunc {
@@ -231,46 +198,6 @@ public class DateTypeFunctions {
}
- @FunctionTemplate(names = {"current_timestamp", "now", "statement_timestamp", "transaction_timestamp"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
- public static class CurrentTimeStamp implements DrillSimpleFunc {
- @Workspace long queryStartDate;
- @Workspace int timezoneIndex;
- @Output TimeStampTZHolder out;
- @Inject QueryDateTimeInfo dateTime;
-
- public void setup() {
-
- int timeZoneIndex = dateTime.getRootFragmentTimeZone();
- org.joda.time.DateTimeZone timeZone = org.joda.time.DateTimeZone.forID(org.apache.drill.exec.expr.fn.impl.DateUtility.getTimeZone(timeZoneIndex));
- org.joda.time.DateTime now = new org.joda.time.DateTime(dateTime.getQueryStartTime(), timeZone);
- queryStartDate = now.getMillis();
- timezoneIndex = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(now.getZone().toString());
- }
-
- public void eval() {
- out.value = queryStartDate;
- out.index = timezoneIndex;
- }
-
- }
-
- @FunctionTemplate(name = "clock_timestamp", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL, isRandom = true)
- public static class ClockTimeStamp implements DrillSimpleFunc {
- @Workspace int timezoneIndex;
- @Output TimeStampTZHolder out;
-
- public void setup() {
- org.joda.time.DateTime now = new org.joda.time.DateTime();
- timezoneIndex = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(now.getZone().toString());
- }
-
- public void eval() {
- org.joda.time.DateTime now = new org.joda.time.DateTime();
- out.value = now.getMillis();
- out.index = timezoneIndex;
- }
- }
-
@FunctionTemplate(name = "timeofday", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL, isRandom = true)
public static class TimeOfDay implements DrillSimpleFunc {
@Inject DrillBuf buffer;
@@ -289,7 +216,7 @@ public class DateTypeFunctions {
}
}
- @FunctionTemplate(name = "localtimestamp", scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
+ @FunctionTemplate(names = {"localtimestamp", "current_timestamp", "now", "statement_timestamp", "transaction_timestamp"}, scope = FunctionTemplate.FunctionScope.SIMPLE, nulls = NullHandling.NULL_IF_NULL)
public static class LocalTimeStamp implements DrillSimpleFunc {
@Workspace long queryStartDate;
@Output TimeStampHolder out;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
index 46fed6f..28b0be7 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/HashFunctions.java
@@ -44,13 +44,11 @@ import org.apache.drill.exec.expr.holders.NullableFloat8Holder;
import org.apache.drill.exec.expr.holders.NullableIntHolder;
import org.apache.drill.exec.expr.holders.NullableTimeHolder;
import org.apache.drill.exec.expr.holders.NullableTimeStampHolder;
-import org.apache.drill.exec.expr.holders.NullableTimeStampTZHolder;
import org.apache.drill.exec.expr.holders.NullableVar16CharHolder;
import org.apache.drill.exec.expr.holders.NullableVarBinaryHolder;
import org.apache.drill.exec.expr.holders.NullableVarCharHolder;
import org.apache.drill.exec.expr.holders.TimeHolder;
import org.apache.drill.exec.expr.holders.TimeStampHolder;
-import org.apache.drill.exec.expr.holders.TimeStampTZHolder;
import org.apache.drill.exec.expr.holders.Var16CharHolder;
import org.apache.drill.exec.expr.holders.VarBinaryHolder;
import org.apache.drill.exec.expr.holders.VarCharHolder;
@@ -372,36 +370,6 @@ public class HashFunctions {
}
@FunctionTemplate(name = "hash", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL)
- public static class TimeStampTZHash implements DrillSimpleFunc {
- @Param TimeStampTZHolder in;
- @Output IntHolder out;
-
- public void setup() {
- }
-
- public void eval() {
- out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value ^ in.index, 0);
- }
- }
-
- @FunctionTemplate(name = "hash", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL)
- public static class NullableTimeStampTZHash implements DrillSimpleFunc {
- @Param NullableTimeStampTZHolder in;
- @Output IntHolder out;
-
- public void setup() {
- }
-
- public void eval() {
- if (in.isSet == 0) {
- out.value = 0;
- } else {
- out.value = org.apache.drill.exec.expr.fn.impl.XXHash.hash32(in.value ^ in.index, 0);
- }
- }
- }
-
- @FunctionTemplate(name = "hash", scope = FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.INTERNAL)
public static class Decimal9Hash implements DrillSimpleFunc {
@Param Decimal9Holder in;
@Output IntHolder out;
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
index 1ecae19..67aa4dd 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
@@ -98,7 +98,6 @@ public class TestDateFunctions extends PopUnitTestBase {
String[] expectedResults = {"P365D",
"P-366DT-60S",
- "PT10800S",
"PT39600S"};
testCommon(expectedResults, "/functions/date/date_difference_arithmetic.json", "/test_simple_date.json");
}
@@ -136,8 +135,7 @@ public class TestDateFunctions extends PopUnitTestBase {
String expectedResults[] = {"2008-Feb-23",
"12 20 30",
- "2008 Feb 23 12:00:00",
- "2008-02-23 20:00:00 America/Los_Angeles"};
+ "2008 Feb 23 12:00:00"};
testCommon(expectedResults, "/functions/date/to_char.json", "/test_simple_date.json");
}
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/java/org/apache/drill/exec/fn/interp/ExpressionInterpreterTest.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/interp/ExpressionInterpreterTest.java b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/interp/ExpressionInterpreterTest.java
index 63dcdb4..4942185 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/fn/interp/ExpressionInterpreterTest.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/fn/interp/ExpressionInterpreterTest.java
@@ -33,7 +33,7 @@ import org.apache.drill.common.util.DrillStringUtils;
import org.apache.drill.exec.expr.ExpressionTreeMaterializer;
import org.apache.drill.exec.expr.TypeHelper;
import org.apache.drill.exec.expr.fn.interpreter.InterpreterEvaluator;
-import org.apache.drill.exec.expr.holders.TimeStampTZHolder;
+import org.apache.drill.exec.expr.holders.TimeStampHolder;
import org.apache.drill.exec.ops.FragmentContext;
import org.apache.drill.exec.ops.QueryDateTimeInfo;
import org.apache.drill.exec.pop.PopUnitTestBase;
@@ -131,16 +131,13 @@ public class ExpressionInterpreterTest extends PopUnitTestBase {
org.joda.time.DateTime now = new org.joda.time.DateTime(dateTime.getQueryStartTime(), timeZone);
long queryStartDate = now.getMillis();
- int timezoneIndex = org.apache.drill.exec.expr.fn.impl.DateUtility.getIndex(now.getZone().toString());
- TimeStampTZHolder out = new TimeStampTZHolder();
+ TimeStampHolder out = new TimeStampHolder();
out.value = queryStartDate;
- out.index = timezoneIndex;
ByteBuffer buffer = ByteBuffer.allocate(12);
buffer.putLong(out.value);
- buffer.putInt(out.index);
long l = buffer.getLong(0);
DateTime t = new DateTime(l);
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
index 33cc2b8..4cc82e4 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/record/vector/TestDateTypes.java
@@ -224,7 +224,6 @@ public class TestDateTypes extends PopUnitTestBase {
String result[] = {"2008-02-27",
"2008-02-27 01:02:03.000",
- "2008-02-27 01:02:03.000 UTC",
"10:11:13.999",
"2 years 2 months 3 days 0:1:3.89"};
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/resources/functions/date/date_difference_arithmetic.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/functions/date/date_difference_arithmetic.json b/exec/java-exec/src/test/resources/functions/date/date_difference_arithmetic.json
index bd8386c..e215b7b 100644
--- a/exec/java-exec/src/test/resources/functions/date/date_difference_arithmetic.json
+++ b/exec/java-exec/src/test/resources/functions/date/date_difference_arithmetic.json
@@ -23,7 +23,6 @@
exprs: [
{ ref: "Date1", expr: "cast('2008-2-23' as date) - cast('2007-2-23' as date)"},
{ ref: "TimeStamp1", expr: "cast('2008-2-23 12:00:00' as timestamp) - cast('2009-2-23 12:01:00' as timestamp) "},
- { ref: "TimeStampTZ1", expr: "cast('2008-2-23 12:00:00 America/Los_Angeles' as timestamptz) - cast('2008-2-23 12:00:00 America/New_York' as timestamptz)"},
{ ref: "Time2", expr: "cast('12:20:30' as time) - cast('1:20:30' as time)"}
]
},
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/resources/functions/date/to_char.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/functions/date/to_char.json b/exec/java-exec/src/test/resources/functions/date/to_char.json
index 0059401..57bee61 100644
--- a/exec/java-exec/src/test/resources/functions/date/to_char.json
+++ b/exec/java-exec/src/test/resources/functions/date/to_char.json
@@ -23,8 +23,7 @@
exprs: [
{ ref: "Date1", expr: "to_char((cast('2008-2-23' as date)), 'yyyy-MMM-dd')"},
{ ref: "Time1", expr: "to_char(cast('12:20:30' as time), 'HH mm ss')"},
- { ref: "TimeStamp2", expr: "to_char(cast('2008-2-23 12:00:00' as timestamp), 'yyyy MMM dd HH:mm:ss')"},
- { ref: "TimeStampTZ1", expr: "to_char(cast('2008-2-23 12:00:00 America/Los_Angeles' as timestamptz), 'yyyy-MM-dd HH:mm:ss ZZZ')"}
+ { ref: "TimeStamp2", expr: "to_char(cast('2008-2-23 12:00:00' as timestamp), 'yyyy MMM dd HH:mm:ss')"}
]
},
{
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/java-exec/src/test/resources/record/vector/test_all_date_literals.json
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/resources/record/vector/test_all_date_literals.json b/exec/java-exec/src/test/resources/record/vector/test_all_date_literals.json
index ac4959a..657b016 100644
--- a/exec/java-exec/src/test/resources/record/vector/test_all_date_literals.json
+++ b/exec/java-exec/src/test/resources/record/vector/test_all_date_literals.json
@@ -23,7 +23,6 @@
exprs: [
{ref: "Date", expr: "cast(datetype(2008, 2, 27) as varchar(100))"},
{ref: "TimeStamp", expr: "cast(timestamptype(2008, 2, 27, 1, 2, 3, 0) as varchar(100))"},
- {ref: "TimeStampTZ", expr: "cast(timestamptztype(2008, 2, 27, 1, 2, 3, 0, 'UTC') as varchar(100))"},
{ref: "Time", expr: "cast(timetype(10,11,13, 999) as varchar(100))"},
{ref: "Interval", expr: "cast(intervaltype(2, 2, 3, 0, 1, 3, 89) as varchar(100))"}
]
http://git-wip-us.apache.org/repos/asf/drill/blob/8faa6642/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
index b627c38..682fca3 100644
--- a/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
+++ b/exec/jdbc/src/test/java/org/apache/drill/jdbc/test/TestJdbcQuery.java
@@ -231,11 +231,10 @@ public class TestJdbcQuery extends JdbcTestQueryBase{
Statement statement = connection.createStatement();
// show files
- ResultSet resultSet = statement.executeQuery("select timestamp '2008-2-23 12:23:23', date '2001-01-01', timestamptztype('2008-2-23 1:20:23 US/Pacific') from cp.`employee.json` limit 1");
+ ResultSet resultSet = statement.executeQuery("select timestamp '2008-2-23 12:23:23', date '2001-01-01' from cp.`employee.json` limit 1");
assert (resultSet.getMetaData().getColumnType(1) == Types.TIMESTAMP);
assert (resultSet.getMetaData().getColumnType(2) == Types.DATE);
- assert (resultSet.getMetaData().getColumnType(3) == Types.TIMESTAMP);
System.out.println(JdbcAssert.toString(resultSet));
resultSet.close();