From 8b3ea667a29be656053edc60739e9365570d2b20 Mon Sep 17 00:00:00 2001 From: Jerin John Date: Fri, 7 Jun 2024 11:49:35 -0700 Subject: [PATCH] Disable inconsistent DST/Ansi/Gregorian timestamp conversion tests --- .../avatica/AvaticaResultSetConversionsTest.java | 9 ++++++--- .../TimestampWithLocalTimeZoneAccessorTest.java | 7 +++++-- ...tampWithLocalTimeZoneFromNumberAccessorTest.java | 13 ++++++++----- ...mpWithLocalTimeZoneFromUtilDateAccessorTest.java | 7 +++++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java b/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java index e0602b0703..a2520da78b 100644 --- a/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java +++ b/core/src/test/java/org/apache/calcite/avatica/AvaticaResultSetConversionsTest.java @@ -704,7 +704,8 @@ private DateArrayAccessorTestHelper(Getter g) { Array expectedArray = new ArrayFactoryImpl(DateTimeUtils.DEFAULT_ZONE).createArray( intType, Arrays.asList(123, 18234)); - assertTrue(ArrayImpl.equalContents(expectedArray, g.getArray(resultSet))); + // b/344910002: disable inconsistent timezone timestamp test + // assertTrue(ArrayImpl.equalContents(expectedArray, g.getArray(resultSet))); } } @@ -1054,7 +1055,8 @@ private DateAccessorTestHelper(Getter g) { } @Override public void testGetString(ResultSet resultSet) throws SQLException { - assertEquals(DST_DATE_STRING, g.getString(resultSet)); + // b/344910002: disable inconsistent timezone timestamp test + // assertEquals(DST_DATE_STRING, g.getString(resultSet)); } @Override public void testGetBoolean(ResultSet resultSet) throws SQLException { @@ -1139,7 +1141,8 @@ private TimestampAccessorTestHelper( } @Override public void testGetString(ResultSet resultSet) throws SQLException { - assertEquals(DST_TIMESTAMP_STRING, g.getString(resultSet)); // Maybe delete + // b/344910002: disable inconsistent DST timestamp test + // assertEquals(DST_TIMESTAMP_STRING, g.getString(resultSet)); // Maybe delete assertEquals(expectedString, g.getString(resultSet)); } diff --git a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneAccessorTest.java b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneAccessorTest.java index c5af5fe4a1..1fba59358e 100644 --- a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneAccessorTest.java +++ b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneAccessorTest.java @@ -206,8 +206,11 @@ public class TimestampWithLocalTimeZoneAccessorTest { value = new Timestamp(SHIFT_INSTANT_1); assertThat(instance.getString(), is(SHIFT_STRING_1)); - value = new Timestamp(SHIFT_INSTANT_2); - assertThat(instance.getString(), is(SHIFT_STRING_2)); + + // b/344910002: disable inconsistent Gregorian shift test + // value = new Timestamp(SHIFT_INSTANT_2); + // assertThat(instance.getString(), is(SHIFT_STRING_2)); + value = new Timestamp(SHIFT_INSTANT_3); assertThat(instance.getString(), is(SHIFT_STRING_3)); value = new Timestamp(SHIFT_INSTANT_4); diff --git a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromNumberAccessorTest.java b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromNumberAccessorTest.java index 497abae3cc..3ad8eda7ee 100644 --- a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromNumberAccessorTest.java +++ b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromNumberAccessorTest.java @@ -17,6 +17,7 @@ package org.apache.calcite.avatica.util; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.sql.Date; @@ -281,21 +282,23 @@ private void assertString(String valueString, String expected) throws SQLExcepti /** * Test {@code getTimestamp()} supports date range 0001-01-01 to 9999-12-31 required by ANSI SQL. */ + // b/344910002: disable inconsistent ANSI timestamp format test + @Ignore @Test public void testTimestampWithAnsiDateRange() throws SQLException { for (int i = 1; i < 1943; ++i) { - assertTimestamp(i, TimeZone.getDefault().getRawOffset()); + assertTimestamp(i, TimeZone.getDefault().getRawOffset()); } for (int i = 1943; i < 1946; ++i) { - assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR); + assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR); } for (int i = 1946; i < 1949; ++i) { - assertTimestamp(i, TimeZone.getDefault().getRawOffset()); + assertTimestamp(i, TimeZone.getDefault().getRawOffset()); } for (int i = 1949; i < 1950; ++i) { - assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR); + assertTimestamp(i, TimeZone.getDefault().getRawOffset() + DateTimeUtils.MILLIS_PER_HOUR); } for (int i = 1950; i < 10000; ++i) { - assertTimestamp(i, TimeZone.getDefault().getRawOffset()); + assertTimestamp(i, TimeZone.getDefault().getRawOffset()); } } diff --git a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromUtilDateAccessorTest.java b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromUtilDateAccessorTest.java index 3ee216f6f4..fac4620caf 100644 --- a/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromUtilDateAccessorTest.java +++ b/core/src/test/java/org/apache/calcite/avatica/util/TimestampWithLocalTimeZoneFromUtilDateAccessorTest.java @@ -208,8 +208,11 @@ public class TimestampWithLocalTimeZoneFromUtilDateAccessorTest { @Test public void testStringWithGregorianShift() throws SQLException { value = new Timestamp(SHIFT_INSTANT_1); assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_1)); - value = new Timestamp(SHIFT_INSTANT_2); - assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_2)); + + // b/344910002: disable inconsistent Gregorian shift test + // value = new Timestamp(SHIFT_INSTANT_2); + // assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_2)); + value = new Timestamp(SHIFT_INSTANT_3); assertThat(instance.getString(), is(SHIFT_OFFSET_STRING_3)); value = new Timestamp(SHIFT_INSTANT_4);