Parse TIMESTAMP literal with parseTimestampLiteral
@@ -89,7 +89,6 @@ import static com.facebook.presto.spi.type.CharType.createCharType;
import static com.facebook.presto.spi.type.DoubleType.DOUBLE;
import static com.facebook.presto.spi.type.IntegerType.INTEGER;
import static com.facebook.presto.spi.type.TimeWithTimeZoneType.TIME_WITH_TIME_ZONE;
-import static com.facebook.presto.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;
import static com.facebook.presto.spi.type.TypeSignature.parseTypeSignature;
import static com.facebook.presto.spi.type.VarbinaryType.VARBINARY;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
@@ -121,8 +120,7 @@ import static com.facebook.presto.type.LikePatternType.LIKE_PATTERN;
import static com.facebook.presto.util.DateTimeUtils.parseDayTimeInterval;
import static com.facebook.presto.util.DateTimeUtils.parseTimeWithTimeZone;
import static com.facebook.presto.util.DateTimeUtils.parseTimeWithoutTimeZone;
-import static com.facebook.presto.util.DateTimeUtils.parseTimestampWithTimeZone;
-import static com.facebook.presto.util.DateTimeUtils.parseTimestampWithoutTimeZone;
+import static com.facebook.presto.util.DateTimeUtils.parseTimestampLiteral;
import static com.facebook.presto.util.DateTimeUtils.parseYearMonthInterval;
import static com.facebook.presto.util.LegacyRowFieldOrdinalAccessUtil.parseAnonymousRowFieldOrdinalAccess;
import static com.google.common.base.Preconditions.checkArgument;
@@ -307,17 +305,11 @@ public final class SqlToRowExpressionTranslator
protected RowExpression visitTimestampLiteral(TimestampLiteral node, Void context)
{
long value;
- if (getType(node).equals(TIMESTAMP_WITH_TIME_ZONE)) {
- value = parseTimestampWithTimeZone(timeZoneKey, node.getValue());
- }
- else {
if (isLegacyTimestamp) {
- // parse in time zone of client
- value = parseTimestampWithoutTimeZone(timeZoneKey, node.getValue());
+ value = parseTimestampLiteral(timeZoneKey, node.getValue());
}
else {
- value = parseTimestampWithoutTimeZone(node.getValue());
- }
+ value = parseTimestampLiteral(node.getValue());
}
return constant(value, getType(node));
}
