Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIME/TIMESTAMP W/O TIME ZONE semantics fix - continuation (v3) #10193

Merged
merged 26 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6be1d25
Add warning concerning legacy_timestamp session property
losipiuk Dec 1, 2017
9b36a3a
Enable tests for non-legacy timestamp semantics
losipiuk Dec 1, 2017
beceeb4
Fix current_time, localtime timezone offset
fiedukow Nov 27, 2017
4d083b2
Introduce new TIME/TIMESTAMP semantics to SQL types
fiedukow Nov 27, 2017
a73de55
Introduce new TIME/TIMESTAMP semantics SPI types
fiedukow Nov 27, 2017
1a13624
Add new TIME/TIMESTAMP parsing/printing to DateTimeUtils
fiedukow Jan 25, 2017
433d103
Add new TIME/TIMESTAMP semantic variant to Expression parsing
fiedukow Nov 27, 2017
11a9df6
Use legacy-flag aware wrappers for SqlTime/SqlTimestamp cration in tests
losipiuk Dec 5, 2017
50d4cee
Fix current_time, localtime & localtimestamp semantics
fiedukow Nov 27, 2017
5d7acc6
Introduce new TIME/TIMESTAMP semantics to scalar functions
fiedukow Nov 27, 2017
a3d21c2
Add new date time semantics to date time cast operators
fiedukow Nov 27, 2017
8cbcbc1
Fix at_timezone(TIME WITH TIME ZONE)
fiedukow Nov 27, 2017
4e650b4
Introduce new TIMESTAMP semantics to to_iso8601 scalar
fiedukow Nov 27, 2017
cc42231
Always use fixed TIME as session base in TestDateTimeFunctions
fiedukow Nov 27, 2017
4251a73
Add tests covering Time types representation
fiedukow Nov 27, 2017
fafbd77
Use Asia/Kathmandu as Cassandra timezone in product-tests
fiedukow Nov 27, 2017
95e8133
Fix timestamp related Teradata Function product-tests
fiedukow Nov 27, 2017
218c9a7
Use non-JVM timezone in TestDateTimeFunctionsBase
losipiuk Nov 27, 2017
9423ba1
Remove transitional TestingSqlTime#sqlTimestampOf method
findepi Jun 5, 2018
acd7b4c
Use named constant for time zone mask in DateTimeEncoding
findepi Nov 28, 2017
2860274
Rename SqlTime#millisUtc to millis
findepi Jun 20, 2018
d02e9a8
Rename SqlTimestamp#millisUtc to millis
findepi Jun 20, 2018
6c87956
Rename DateTimeUtils#parseTime to parseTimeLiteral
findepi Jun 21, 2018
487d2e2
Add documentation for DateTimeUtils#parse* methods
findepi Jun 23, 2018
ebbd73f
Parse TIMESTAMP literal with parseTimestampLiteral
findepi Jun 23, 2018
eb3d770
Accept values with zone in varchar to timestamp cast
findepi Jun 23, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.spi.type.VarcharType.createUnboundedVarcharType;
import static com.facebook.presto.spi.type.Varchars.isVarcharType;
import static com.facebook.presto.testing.DateTimeTestingUtils.sqlTimestampOf;
import static com.facebook.presto.testing.MaterializedResult.materializeSourceDataStream;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
Expand Down Expand Up @@ -3401,7 +3402,7 @@ else if (rowNumber % 19 == 1) {
assertNull(row.getField(index));
}
else {
SqlTimestamp expected = new SqlTimestamp(new DateTime(2011, 5, 6, 7, 8, 9, 123, timeZone).getMillis(), UTC_KEY);
SqlTimestamp expected = sqlTimestampOf(2011, 5, 6, 7, 8, 9, 123, timeZone, UTC_KEY, SESSION);
assertEquals(row.getField(index), expected);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import static com.facebook.presto.spi.type.VarcharType.createUnboundedVarcharType;
import static com.facebook.presto.spi.type.VarcharType.createVarcharType;
import static com.facebook.presto.spi.type.Varchars.isVarcharType;
import static com.facebook.presto.testing.DateTimeTestingUtils.sqlTimestampOf;
import static com.facebook.presto.testing.MaterializedResult.materializeSourceDataStream;
import static com.facebook.presto.tests.StructuralTestUtil.arrayBlockOf;
import static com.facebook.presto.tests.StructuralTestUtil.decimalArrayBlockOf;
Expand Down Expand Up @@ -750,7 +751,7 @@ else if (testColumn.getObjectInspector().getTypeName().equals("int") ||
assertEquals(actualValue, expectedValue);
}
else if (testColumn.getObjectInspector().getTypeName().equals("timestamp")) {
SqlTimestamp expectedTimestamp = new SqlTimestamp((Long) expectedValue, SESSION.getTimeZoneKey());
SqlTimestamp expectedTimestamp = sqlTimestampOf((Long) expectedValue, SESSION);
assertEquals(actualValue, expectedTimestamp, "Wrong value for column " + testColumn.getName());
}
else if (testColumn.getObjectInspector().getTypeName().startsWith("char")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@
import static com.facebook.presto.spi.type.IntegerType.INTEGER;
import static com.facebook.presto.spi.type.RealType.REAL;
import static com.facebook.presto.spi.type.RowType.field;
import static com.facebook.presto.spi.type.TimeZoneKey.UTC_KEY;
import static com.facebook.presto.spi.type.TimestampType.TIMESTAMP;
import static com.facebook.presto.spi.type.VarbinaryType.VARBINARY;
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.spi.type.VarcharType.createUnboundedVarcharType;
import static com.facebook.presto.testing.DateTimeTestingUtils.sqlTimestampOf;
import static com.facebook.presto.testing.TestingConnectorSession.SESSION;
import static com.facebook.presto.tests.StructuralTestUtil.mapType;
import static com.google.common.base.Functions.compose;
import static com.google.common.base.Preconditions.checkArgument;
Expand Down Expand Up @@ -1724,7 +1725,7 @@ private static SqlTimestamp intToSqlTimestamp(Integer input)
if (input == null) {
return null;
}
return new SqlTimestamp(input, UTC_KEY);
return sqlTimestampOf(input, SESSION);
}

private static Date intToDate(Integer input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import static com.facebook.presto.spi.type.TimeWithTimeZoneType.TIME_WITH_TIME_ZONE;
import static com.facebook.presto.spi.type.TimestampType.TIMESTAMP;
import static com.facebook.presto.spi.type.TimestampWithTimeZoneType.TIMESTAMP_WITH_TIME_ZONE;
import static com.facebook.presto.util.DateTimeUtils.parseTime;
import static com.facebook.presto.util.DateTimeUtils.parseTimeLiteral;
import static com.facebook.presto.util.DateTimeUtils.parseTimestampWithTimeZone;
import static com.facebook.presto.util.DateTimeUtils.parseTimestampWithoutTimeZone;
import static com.google.common.base.Preconditions.checkState;
Expand Down Expand Up @@ -143,7 +143,7 @@ private Object convertValue(Object value, Type type)
return value;
}
if (TIME.equals(type)) {
return ISO8601_FORMATTER.print(parseTime(timeZoneKey, (String) value));
return ISO8601_FORMATTER.print(parseTimeLiteral(timeZoneKey, (String) value));
}
if (TIMESTAMP.equals(type)) {
return ISO8601_FORMATTER.print(parseTimestampWithoutTimeZone(timeZoneKey, (String) value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public SystemSessionProperties(
false),
booleanSessionProperty(
LEGACY_TIMESTAMP,
"Use legacy TIME & TIMESTAMP semantics",
"Use legacy TIME & TIMESTAMP semantics (warning: this will be removed)",
featuresConfig.isLegacyTimestamp(),
true),
booleanSessionProperty(
Expand Down
Loading