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

Serafin/compact headers #24202

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "Verify checked out commits and setup Java"
inputs:
java-version:
description: "Java version to setup"
default: 23
default: 24-ea
cache:
description: "Cache Maven repo (true/false/restore)"
default: restore
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ jobs:
fail-fast: false
matrix:
include:
- { java-version: 23, cache: 'true', cleanup-node: true }
- { java-version: 24-ea, cache: 'restore', cleanup-node: true }
- { java-version: 24-ea, cache: 'true', cleanup-node: true }
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -513,7 +512,7 @@ jobs:
with:
cache: restore
cleanup-node: ${{ format('{0}', matrix.modules == 'plugin/trino-singlestore' || matrix.modules == 'plugin/trino-exasol') }}
java-version: ${{ matrix.jdk != '' && matrix.jdk || '23' }}
java-version: ${{ matrix.jdk != '' && matrix.jdk || '24-ea' }}
- name: Maven Install
run: |
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import javax.security.auth.Subject;
import javax.security.auth.kerberos.KerberosTicket;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.util.Set;

Expand All @@ -28,7 +30,7 @@
public class DelegatedUnconstrainedContextProvider
extends AbstractUnconstrainedContextProvider
{
private final Subject subject = Subject.getSubject(AccessController.getContext());
private final Subject subject = current();

@Override
protected Subject getSubject()
Expand All @@ -55,4 +57,16 @@ public void refresh()
}
}
}

private static Subject current()
{
try {
Method current = Subject.class.getDeclaredMethod("current");
return (Subject) current.invoke(null);
}
catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) {
// Fallback to pre-Java 17 method
return Subject.getSubject(AccessController.getContext());
}
}
}
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 @@ -1092,16 +1092,6 @@ 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);
checkIsGap(ZoneId.systemDefault(), jvmGapDate.atTime(LocalTime.MIDNIGHT));

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

assertBind((ps, i) -> ps.setObject(i, jvmGapDate, Types.DATE), explicitPrepare)
.roundTripsAs(Types.DATE, Date.valueOf(jvmGapDate));
}

@Test
Expand Down Expand Up @@ -1705,11 +1695,6 @@ Connection createConnection()
throws SQLException;
}

private static void checkIsGap(ZoneId zone, LocalDateTime dateTime)
{
verify(isGap(zone, dateTime), "Expected %s to be a gap in %s", dateTime, zone);
}

private static boolean isGap(ZoneId zone, LocalDateTime dateTime)
{
return zone.getRules().getValidOffsets(dateTime).isEmpty();
Expand Down
2 changes: 0 additions & 2 deletions core/docker/default/etc/jvm.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@
-Dfile.encoding=UTF-8
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
# https://bugs.openjdk.org/browse/JDK-8327134
-Djava.security.manager=allow
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-24+24-ea-beta
1 change: 0 additions & 1 deletion core/jdk/temurin/24-loom+1-17/amd64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/24-loom+1-17/arm64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-22.0.2+9/amd64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-22.0.2+9/arm64

This file was deleted.

1 change: 0 additions & 1 deletion core/jdk/temurin/jdk-22.0.2+9/ppc64le

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-23.0.1+11/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-24+24-ea-beta/linux/x64/jdk/hotspot/normal/eclipse?project=jdk
1 change: 1 addition & 0 deletions core/jdk/temurin/jdk-24+24-ea-beta/arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-24+24-ea-beta/linux/aarch64/jdk/hotspot/normal/eclipse?project=jdk
1 change: 1 addition & 0 deletions core/jdk/temurin/jdk-24+24-ea-beta/ppc64le
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
distributionUrl=https://api.adoptium.net/v3/binary/version/jdk-24+24-ea-beta/linux/ppc64le/jdk/hotspot/normal/eclipse?project=jdk
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ else if ("Mac OS X".equals(osName)) {

private static void verifyJavaVersion()
{
Version required = Version.parse("23+37");

Version required = Version.parse("24-beta+24-ea");
if (Runtime.version().compareTo(required) < 0) {
failRequirement("Trino requires Java %s at minimum (found %s)", required, Runtime.version());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
-Dfile.encoding=UTF-8
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
# https://bugs.openjdk.org/browse/JDK-8327134
-Djava.security.manager=allow
-XX:+UnlockExperimentalVMOptions
-XX:+UseCompactObjectHeaders
12 changes: 6 additions & 6 deletions core/trino-server-rpm/src/main/rpm/preinstall
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ check_if_correct_java_version() {
# candidate for JAVA_HOME).
JAVA_VERSION=$(java_version "$1")
JAVA_MAJOR=$(echo "$JAVA_VERSION" | cut -d'-' -f1 | cut -d'.' -f1)
if [ "$JAVA_MAJOR" -ge "23" ]; then
if [ "$JAVA_MAJOR" -ge "24" ]; then
echo "$1" >/tmp/trino-rpm-install-java-home
return 0
else
Expand All @@ -34,10 +34,10 @@ check_if_correct_java_version() {
if ! check_if_correct_java_version "$JAVA_HOME"; then
java_found=false
for candidate in \
/usr/lib/jvm/java-23-* \
/usr/lib/jvm/zulu-23 \
/usr/lib/jvm/temurin-23 \
/usr/lib/jvm/temurin-23-* \
/usr/lib/jvm/java-24-* \
/usr/lib/jvm/zulu-24 \
/usr/lib/jvm/temurin-24 \
/usr/lib/jvm/temurin-24-* \
/usr/lib/jvm/default-java \
/usr/java/default \
/ \
Expand All @@ -57,7 +57,7 @@ if [ "$java_found" = false ]; then
+======================================================================+
| Error: Required Java version could not be found |
+----------------------------------------------------------------------+
| JDK 23 was not detected. |
| JDK 24 was not detected. |
| Recommended JDK distribution is Eclipse Temurin. |
| Installation guide: https://adoptium.net/installation/linux/ |
| |
Expand Down
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-24+24-ea-beta", "/usr/lib/jvm/temurin-24", "24");
testUninstall("jdk-24+24-ea-beta", "/usr/lib/jvm/temurin-24");
}

private void testInstall(String temurinReleaseName, String javaHome, String expectedJavaVersion)
Expand Down
2 changes: 0 additions & 2 deletions docs/src/main/sphinx/installation/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ The following provides a good starting point for creating `etc/jvm.config`:
-Dfile.encoding=UTF-8
# Allow loading dynamic agent used by JOL
-XX:+EnableDynamicAgentLoading
# https://bugs.openjdk.org/browse/JDK-8327134
-Djava.security.manager=allow
```

You must adjust the value for the memory used by Trino, specified with `-Xmx`
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 All @@ -44,7 +43,6 @@
import java.util.function.BiFunction;
import java.util.function.Function;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static io.trino.plugin.cassandra.TestCassandraTable.generalColumn;
import static io.trino.plugin.cassandra.TestCassandraTable.partitionColumn;
Expand Down Expand Up @@ -81,9 +79,6 @@ 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 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);

// no DST in 1970, but has DST in later years (e.g. 2018)
private final ZoneId vilnius = ZoneId.of("Europe/Vilnius");
Expand All @@ -103,13 +98,6 @@ public class TestCassandraTypeMapping
@BeforeAll
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
checkIsDoubled(jvmZone, timeDoubledInJvmZone);

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
checkIsGap(vilnius, dateOfLocalTimeChangeForwardAtMidnightInSomeZone.atStartOfDay());
LocalDate dateOfLocalTimeChangeBackwardAtMidnightInSomeZone = LocalDate.of(1983, 10, 1);
Expand Down Expand Up @@ -516,9 +504,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 Expand Up @@ -590,10 +575,7 @@ private SqlDataTypeTest timestampTest(String inputType, BiFunction<LocalDateTime
.addRoundTrip(inputType, inputLiteralFactory.apply(beforeEpoch, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(beforeEpoch, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(epoch, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(epoch, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(afterEpoch, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(afterEpoch, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeDoubledInJvmZone, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeDoubledInJvmZone, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeDoubledInVilnius, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeDoubledInVilnius, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeGapInJvmZone1, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeGapInJvmZone1, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeGapInJvmZone2, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeGapInJvmZone2, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeGapInVilnius, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeGapInVilnius, zoneId))
.addRoundTrip(inputType, inputLiteralFactory.apply(timeGapInKathmandu, zoneId), TIMESTAMP_TZ_MILLIS, expectedLiteralFactory.apply(timeGapInKathmandu, zoneId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.List;
import java.util.function.Function;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static io.trino.plugin.clickhouse.ClickHouseQueryRunner.TPCH_SCHEMA;
import static io.trino.plugin.jdbc.TypeHandlingJdbcSessionProperties.UNSUPPORTED_TYPE_HANDLING;
Expand Down Expand Up @@ -78,10 +77,6 @@ public abstract class BaseClickHouseTypeMapping
@BeforeAll
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
checkIsGap(vilnius, dateOfLocalTimeChangeForwardAtMidnightInSomeZone.atStartOfDay());
LocalDate dateOfLocalTimeChangeBackwardAtMidnightInSomeZone = LocalDate.of(1983, 10, 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,12 +107,10 @@ public void registerTables()
}

@Test
@Disabled("TODO: regenerate test data using correct timezone definitions")
public void timestampReadMapping()
{
ZoneId jvmZone = getJvmTestTimeZone();
verify(jvmZone.getRules().getValidOffsets(LocalDateTime.parse("1970-01-01T00:05:00.123")).isEmpty());
verify(jvmZone.getRules().getValidOffsets(LocalDateTime.parse("1996-10-27T01:05:00.987")).size() == 2);

ZoneId vilniusZone = ZoneId.of("Europe/Vilnius");
verify(vilniusZone.getRules().getValidOffsets(LocalDateTime.parse("1983-04-01T00:05:00.345")).isEmpty());
verify(vilniusZone.getRules().getValidOffsets(LocalDateTime.parse("1983-09-30T23:59:00.654")).size() == 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.time.LocalDateTime;
import java.time.ZoneId;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static io.trino.plugin.exasol.TestingExasolServer.TEST_SCHEMA;
import static io.trino.spi.type.BooleanType.BOOLEAN;
Expand All @@ -52,10 +51,6 @@ 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 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);

// no DST in 1970, but has DST in later years (e.g. 2018)
private static final ZoneId vilnius = ZoneId.of("Europe/Vilnius");
private static final LocalDateTime timeGapInVilnius = LocalDateTime.of(2018, 3, 25, 3, 17, 17);
Expand All @@ -76,11 +71,6 @@ protected QueryRunner createQueryRunner()
@BeforeAll
void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
checkIsDoubled(jvmZone, timeDoubledInJvmZone);

LocalDate dateOfLocalTimeChangeForwardAtMidnightInSomeZone = LocalDate.of(1983, 4, 1);
checkIsGap(vilnius, dateOfLocalTimeChangeForwardAtMidnightInSomeZone.atStartOfDay());
LocalDate dateOfLocalTimeChangeBackwardAtMidnightInSomeZone = LocalDate.of(1983, 10, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.time.LocalDate;
import java.time.ZoneId;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.BooleanType.BOOLEAN;
Expand Down Expand Up @@ -72,8 +71,6 @@ protected QueryRunner createQueryRunner()
@BeforeAll
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(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 @@ -30,7 +30,6 @@
import java.time.ZoneId;
import java.util.function.Function;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static io.trino.spi.type.BigintType.BIGINT;
import static io.trino.spi.type.BooleanType.BOOLEAN;
Expand Down Expand Up @@ -67,9 +66,6 @@ final class TestKuduTypeMapping
@BeforeAll
public void setUp()
{
checkState(jvmZone.getId().equals("America/Bahia_Banderas"), "This test assumes certain JVM time zone");
LocalDate dateOfLocalTimeChangeForwardAtMidnightInJvmZone = LocalDate.of(1970, 1, 1);
checkIsGap(jvmZone, dateOfLocalTimeChangeForwardAtMidnightInJvmZone.atStartOfDay());
checkIsGap(jvmZone, timeGapInJvmZone1);
checkIsGap(jvmZone, timeGapInJvmZone2);
checkIsDoubled(jvmZone, timeDoubledInJvmZone);
Expand Down
Loading
Loading