From 94cac3c5a97452180498dece7ee4917b4fc21f57 Mon Sep 17 00:00:00 2001 From: brandboat Date: Mon, 31 May 2021 10:47:03 +0800 Subject: [PATCH] Remove oracle legacy timestamp test Since commit Fix timestamp semantics (53bafb4) remove legacy timestamp, testLegacyDateMapping() and testLegacyDateReadMapping() are doing the same thing as testDateMapping() and testDateReadMapping(). --- .../oracle/AbstractTestOracleTypeMapping.java | 65 ------------------- 1 file changed, 65 deletions(-) diff --git a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java index ed5708f0c297a..e9f9a8af809d5 100644 --- a/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java +++ b/plugin/trino-oracle/src/test/java/io/trino/plugin/oracle/AbstractTestOracleTypeMapping.java @@ -661,57 +661,6 @@ public void testVarbinary() /* Datetime tests */ - @Test - public void testLegacyDateMapping() - { - legacyDateTests(zone -> trinoCreateAsSelect("l_date_" + zone)); - } - - @Test - public void testLegacyDateReadMapping() - { - legacyDateTests(zone -> oracleCreateAndInsert("l_read_date_" + zone)); - } - - private void legacyDateTests(Function dataSetup) - { - Map zonesBySqlName = ImmutableMap.of( - "UTC", UTC_KEY, - "JVM", getTimeZoneKey(ZoneId.systemDefault().getId()), - "other", getTimeZoneKey(ZoneId.of("Europe/Vilnius").getId())); - - for (Map.Entry zone : zonesBySqlName.entrySet()) { - runLegacyTimestampTestInZone( - dataSetup.apply(zone.getKey()), - zone.getValue().getId(), - legacyDateTests()); - } - } - - private static DataTypeTest legacyDateTests() - { - ZoneId someZone = ZoneId.of("Europe/Vilnius"); - - LocalDate dateOfLocalTimeChangeBackwardAtMidnightInSomeZone = - LocalDate.of(1983, 10, 1); - - verify(someZone.getRules().getValidOffsets( - dateOfLocalTimeChangeBackwardAtMidnightInSomeZone - .atStartOfDay().minusMinutes(1)).size() == 2); - - return DataTypeTest.create() - // before epoch - .addRoundTrip(dateDataType(), LocalDate.of(1952, 4, 3)) - .addRoundTrip(dateDataType(), LocalDate.of(1970, 2, 3)) - // summer on northern hemisphere (possible DST) - .addRoundTrip(dateDataType(), LocalDate.of(2017, 7, 1)) - // winter on northern hemisphere - // (possible DST on southern hemisphere) - .addRoundTrip(dateDataType(), LocalDate.of(2017, 1, 1)) - .addRoundTrip(dateDataType(), - dateOfLocalTimeChangeBackwardAtMidnightInSomeZone); - } - @Test public void testDateMapping() { @@ -943,20 +892,6 @@ private void runTestsWithSetup(DataSetup dataSetup, DataTypeTest... tests) } } - /** - * Run a {@link DataTypeTest} in the given time zone, using legacy timestamps. - *

- * If the given time zone is {@code null}, use the default session time zone. - */ - private void runLegacyTimestampTestInZone(DataSetup dataSetup, String zone, DataTypeTest test) - { - Session.SessionBuilder session = Session.builder(getSession()); - if (zone != null) { - session.setTimeZoneKey(getTimeZoneKey(zone)); - } - test.execute(getQueryRunner(), session.build(), dataSetup); - } - /** * Run a {@link DataTypeTest} in the given time zone, using non-legacy timestamps. *