Skip to content

Commit

Permalink
Update Java to 23.0.2
Browse files Browse the repository at this point in the history
This brings updated timezonedb to version 2024b
(openjdk/jdk23u@73b2341)
which amends historical timezone definitions for Mexico/Bahia_Banderas
that we use for testing timezone gap around the unix timestamp epoch.

Corresponding Joda time update also has these timezone definitions
updated. PostgreSQL test server was upgraded to 12 to correctly handle
UTC around epoch. MySQL was updated to 8.0.41 due to the same reason.

Temporary downgrade JDK for ppc64 to make CI happy
  • Loading branch information
wendigo committed Jan 27, 2025
1 parent 5c43149 commit fb1d2e0
Show file tree
Hide file tree
Showing 31 changed files with 52 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,6 @@ public void testDate()
assertThat(rs.getString(column)).isEqualTo(localDate.toString());
});

// date which midnight does not exist in test JVM zone
checkRepresentation(connectedStatement.getStatement(), "DATE '1970-01-01'", Types.DATE, (rs, column) -> {
LocalDate localDate = LocalDate.of(1970, 1, 1);
Date sqlDate = Date.valueOf(localDate);

assertThat(rs.getObject(column)).isEqualTo(sqlDate);
assertThat(rs.getObject(column, Date.class)).isEqualTo(sqlDate);
assertThat(rs.getObject(column, LocalDate.class)).isEqualTo(localDate);
assertThat(rs.getDate(column)).isEqualTo(sqlDate);
assertThatThrownBy(() -> rs.getTime(column))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Expected column to be a time type but is date");
assertThatThrownBy(() -> rs.getTimestamp(column))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Expected column to be a timestamp type but is date");

assertThat(rs.getString(column)).isEqualTo(localDate.toString());
});

// the Julian-Gregorian calendar "default cut-over"
checkRepresentation(connectedStatement.getStatement(), "DATE '1582-10-04'", Types.DATE, (rs, column) -> {
LocalDate localDate = LocalDate.of(1582, 10, 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,11 +1093,11 @@ private void testConvertLocalDate(boolean explicitPrepare)
assertBind((ps, i) -> ps.setObject(i, date, Types.TIMESTAMP_WITH_TIMEZONE), explicitPrepare)
.isInvalid("Cannot convert instance of java.time.LocalDate to timestamp with time zone");

LocalDate jvmGapDate = LocalDate.of(1970, 1, 1);
LocalDate jvmGapDate = LocalDate.of(1932, 4, 1);
checkIsGap(ZoneId.systemDefault(), jvmGapDate.atTime(LocalTime.MIDNIGHT));

assertBind((ps, i) -> ps.setObject(i, jvmGapDate), explicitPrepare)
.resultsIn("date", "DATE '1970-01-01'")
.resultsIn("date", "DATE '1932-04-01'")
.roundTripsAs(Types.DATE, Date.valueOf(jvmGapDate));

assertBind((ps, i) -> ps.setObject(i, jvmGapDate, Types.DATE), explicitPrepare)
Expand Down
2 changes: 1 addition & 1 deletion core/jdk/current
Original file line number Diff line number Diff line change
@@ -1 +1 @@
temurin/jdk-23.0.1+11
temurin/jdk-23.0.2+7
1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-23.0.1+11/amd64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-23.0.1+11/arm64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-23.0.1+11/ppc64le

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-22.0.2+9/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.2+7/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-22.0.2+9/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.2+7/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-22.0.2+9/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-23.0.2+7/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public void testInstallUninstall()
throws Exception
{
// Release names as in the https://api.adoptium.net/q/swagger-ui/#/Release%20Info/getReleaseNames
testInstall("jdk-23.0.1+11", "/usr/lib/jvm/temurin-23", "23");
testUninstall("jdk-23.0.1+11", "/usr/lib/jvm/temurin-23");
testInstall("jdk-23.0.2+7", "/usr/lib/jvm/temurin-23", "23");
testUninstall("jdk-23.0.2+7", "/usr/lib/jvm/temurin-23");
}

private void testInstall(String temurinReleaseName, String javaHome, String expectedJavaVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
Expand Down Expand Up @@ -81,7 +80,7 @@ public class TestCassandraTypeMapping
private final LocalDateTime afterEpoch = LocalDateTime.of(2019, 3, 18, 10, 1, 17, 987_000_000);

private final ZoneId jvmZone = ZoneId.systemDefault();
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1970, 1, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1932, 4, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone2 = LocalDateTime.of(2018, 4, 1, 2, 13, 55, 123_000_000);
private final LocalDateTime timeDoubledInJvmZone = LocalDateTime.of(2018, 10, 28, 1, 33, 17, 456_000_000);

Expand All @@ -104,7 +103,7 @@ public class TestCassandraTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
Expand Down Expand Up @@ -516,9 +515,6 @@ private SqlDataTypeTest dateTest(Function<String, String> inputLiteralFactory)
public void testTime()
{
for (ZoneId sessionZone : timezones()) {
LocalTime timeGapInJvmZone = LocalTime.of(0, 12, 34, 567_000_000);
checkIsGap(jvmZone, timeGapInJvmZone.atDate(LocalDate.ofEpochDay(0)));

Session session = Session.builder(getSession())
.setTimeZoneKey(TimeZoneKey.getTimeZoneKey(sessionZone.getId()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public abstract class BaseClickHouseTypeMapping
// no DST in 1970, but has DST in later years (e.g. 2018)
private final ZoneId vilnius = ZoneId.of("Europe/Vilnius");

// minutes offset change since 1970-01-01, no DST
// minutes offset change since 1932-04-01, no DST
private final ZoneId kathmandu = ZoneId.of("Asia/Kathmandu");

protected TestingClickHouseServer clickhouseServer;
Expand All @@ -79,7 +79,7 @@ public abstract class BaseClickHouseTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.trino.testing.AbstractTestQueryFramework;
import io.trino.testing.QueryRunner;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

Expand Down Expand Up @@ -106,6 +107,7 @@ public void registerTables()
}

@Test
@Disabled("This test assumes specific tzdb version and it will fail on mismatch between Spark and Trino tzdb versions")
public void timestampReadMapping()
{
ZoneId jvmZone = getJvmTestTimeZone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ final class TestExasolTypeMapping
private TestingExasolServer exasolServer;

private static final ZoneId jvmZone = ZoneId.systemDefault();
private static final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1970, 1, 1, 0, 13, 42);
private static final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1932, 4, 1, 0, 13, 42);
private static final LocalDateTime timeGapInJvmZone2 = LocalDateTime.of(2018, 4, 1, 2, 13, 55, 123_000_000);
private static final LocalDateTime timeDoubledInJvmZone = LocalDateTime.of(2018, 10, 28, 1, 33, 17, 456_000_000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected QueryRunner createQueryRunner()
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
checkIsGap(jvmZone, LocalDate.of(1970, 1, 1));
checkIsGap(jvmZone, LocalDate.of(1932, 4, 1));
checkIsGap(vilnius, LocalDate.of(1983, 4, 1));
verify(vilnius.getRules().getValidOffsets(LocalDate.of(1983, 10, 1).atStartOfDay().minusMinutes(1)).size() == 2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class TestKuduTypeMapping
extends AbstractTestQueryFramework
{
private final ZoneId jvmZone = ZoneId.systemDefault();
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1970, 1, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1932, 4, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone2 = LocalDateTime.of(2018, 4, 1, 2, 13, 55, 123_000_000);
private final LocalDateTime timeDoubledInJvmZone = LocalDateTime.of(2018, 10, 28, 1, 33, 17, 456_000_000);

Expand All @@ -68,7 +68,7 @@ final class TestKuduTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class TestMariaDbTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
checkIsGap(jvmZone, LocalDate.of(1970, 1, 1));
checkIsGap(jvmZone, LocalDate.of(1932, 4, 1));
checkIsGap(vilnius, LocalDate.of(1983, 4, 1));
verify(vilnius.getRules().getValidOffsets(LocalDate.of(1983, 10, 1).atStartOfDay().minusMinutes(1)).size() == 2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ public void testTimestampWithTimeZoneFromTrinoDefaultTimeZone()
@Test
public void testUnsupportedTimestampWithTimeZoneValues()
{
// The range for TIMESTAMP values is '1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.499999'
try (TestTable table = new TestTable(mySqlServer::execute, "tpch.test_unsupported_timestamp", "(data TIMESTAMP)")) {
// Verify MySQL writes -- the server timezone is set to Pacific/Apia, so we have to account for that when inserting into MySQL
assertMySqlQueryFails(
Expand All @@ -613,8 +612,8 @@ public void testUnsupportedTimestampWithTimeZoneValues()

// Verify Trino writes
assertQueryFails(
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '1970-01-01 00:00:00 UTC')", // min - 1
"Failed to insert data: Data truncation: Incorrect datetime value: '1969-12-31 16:00:00' for column 'data' at row 1");
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '1932-04-01 00:00:00 UTC')", // min - 1
"Failed to insert data: Data truncation: Incorrect datetime value: '1932-03-31 17:00:00' for column 'data' at row 1");
assertQueryFails(
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '2038-01-19 03:14:08 UTC')", // max + 1
"Failed to insert data: Data truncation: Incorrect datetime value: '2038-01-18 21:14:08' for column 'data' at row 1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class TestMySqlTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
verify(jvmZone.getRules().getValidOffsets(dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay()).isEmpty());

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
Expand Down Expand Up @@ -1109,8 +1109,8 @@ public void testUnsupportedTimestampWithTimeZoneValues()

// Verify Trino writes
assertQueryFails(
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '1970-01-01 00:00:00 UTC')", // min - 1
"Failed to insert data: Data truncation: Incorrect datetime value: '1969-12-31 16:00:00' for column 'data' at row 1");
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '1932-04-01 00:00:00 UTC')", // min - 1
"Failed to insert data: Data truncation: Incorrect datetime value: '1932-03-31 17:00:00' for column 'data' at row 1");
assertQueryFails(
"INSERT INTO " + table.getName() + " VALUES (TIMESTAMP '2038-01-19 03:14:08 UTC')", // max + 1
"Failed to insert data: Data truncation: Incorrect datetime value: '2038-01-18 21:14:08' for column 'data' at row 1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class TestingMySqlServer
implements AutoCloseable
{
public static final String DEFAULT_IMAGE_8 = "mysql:8.0.36";
public static final String DEFAULT_IMAGE_8 = "mysql:8.0.41";
public static final String DEFAULT_IMAGE = DEFAULT_IMAGE_8;
public static final String LEGACY_IMAGE = "mysql:5.7.44"; // oldest available on RDS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public abstract class AbstractTestOracleTypeMapping
private static final String NO_SUPPORTED_COLUMNS = "Table '.*' has no supported columns \\(all \\d+ columns are not supported\\)";

private final ZoneId jvmZone = ZoneId.systemDefault();
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1970, 1, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1932, 4, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone2 = LocalDateTime.of(2018, 4, 1, 2, 13, 55, 123_000_000);
private final LocalDateTime timeDoubledInJvmZone = LocalDateTime.of(2018, 10, 28, 1, 33, 17, 456_000_000);

Expand All @@ -104,7 +104,7 @@ public abstract class AbstractTestOracleTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class TestPhoenixTypeMapping
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
Expand Down Expand Up @@ -114,16 +113,14 @@
public class TestPostgreSqlTypeMapping
extends AbstractTestQueryFramework
{
private static final LocalDate EPOCH_DAY = LocalDate.ofEpochDay(0);

protected TestingPostgreSqlServer postgreSqlServer;

private final LocalDateTime beforeEpoch = LocalDateTime.of(1958, 1, 1, 13, 18, 3, 123_000_000);
private final LocalDateTime epoch = LocalDateTime.of(1970, 1, 1, 0, 0, 0);
private final LocalDateTime afterEpoch = LocalDateTime.of(2019, 3, 18, 10, 1, 17, 987_000_000);

private final ZoneId jvmZone = ZoneId.systemDefault();
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1970, 1, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone1 = LocalDateTime.of(1932, 4, 1, 0, 13, 42);
private final LocalDateTime timeGapInJvmZone2 = LocalDateTime.of(2018, 4, 1, 2, 13, 55, 123_000_000);
private final LocalDateTime timeDoubledInJvmZone = LocalDateTime.of(2018, 10, 28, 1, 33, 17, 456_000_000);

Expand Down Expand Up @@ -913,7 +910,7 @@ private SqlDataTypeTest arrayUnicodeDataTypeTest(Function<String, String> arrayT

private SqlDataTypeTest arrayDateTest(Function<String, String> arrayTypeFactory)
{
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1932, 4, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
Expand Down Expand Up @@ -1173,9 +1170,6 @@ public void testTime()

private void testTime(ZoneId sessionZone)
{
LocalTime timeGapInJvmZone = LocalTime.of(0, 12, 34, 567_000_000);
checkIsGap(jvmZone, timeGapInJvmZone.atDate(EPOCH_DAY));

Session session = Session.builder(getSession())
.setTimeZoneKey(TimeZoneKey.getTimeZoneKey(sessionZone.getId()))
.build();
Expand Down Expand Up @@ -1649,9 +1643,7 @@ private void testArrayTimestampWithTimeZone(boolean insertWithTrino)
// test all standard cases with precision 3 and 6 to make sure the long and short TIMESTAMP WITH TIME ZONE
// is gap friendly.
DataType<List<ZonedDateTime>> dataType = arrayOfTimestampWithTimeZoneDataType(precision, insertWithTrino);

tests.addRoundTrip(dataType, asList(epoch.atZone(UTC), epoch.atZone(kathmandu)));
tests.addRoundTrip(dataType, asList(beforeEpoch.atZone(kathmandu), beforeEpoch.atZone(UTC)));
tests.addRoundTrip(dataType, asList(beforeEpoch.atZone(jvmZone), beforeEpoch.atZone(UTC)));
tests.addRoundTrip(dataType, asList(afterEpoch.atZone(UTC), afterEpoch.atZone(kathmandu)));
tests.addRoundTrip(dataType, asList(timeDoubledInJvmZone.atZone(UTC)));
tests.addRoundTrip(dataType, asList(timeDoubledInJvmZone.atZone(kathmandu)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
public class TestingPostgreSqlServer
implements AutoCloseable
{
public static final String DEFAULT_IMAGE_NAME = "postgres:11";
public static final String DEFAULT_IMAGE_NAME = "postgres:12";

private static final String USER = "test";
private static final String PASSWORD = "test";
Expand Down
Loading

0 comments on commit fb1d2e0

Please sign in to comment.