Skip to content

Commit

Permalink
Merge branch 'master' into xkrogen/hybrid-development-plugins-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
xkrogen authored Nov 4, 2024
2 parents 631e3e8 + c5076d7 commit 85f200a
Show file tree
Hide file tree
Showing 1,691 changed files with 31,332 additions and 24,866 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ jobs:
id: tests
run: |
$MAVEN test ${MAVEN_TEST} -pl '
!:trino-accumulo,
!:trino-base-jdbc,
!:trino-bigquery,
!:trino-cassandra,
Expand Down Expand Up @@ -443,7 +442,6 @@ jobs:
- { modules: lib/trino-filesystem-gcs, profile: cloud-tests }
- { modules: lib/trino-filesystem-s3, profile: cloud-tests }
- { modules: lib/trino-hdfs, profile: cloud-tests }
- { modules: plugin/trino-accumulo }
- { modules: plugin/trino-bigquery }
- { modules: plugin/trino-bigquery, profile: cloud-tests-2 }
- { modules: plugin/trino-cassandra }
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/upload-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
types:
- completed

permissions:
actions: read

defaults:
run:
shell: bash --noprofile --norc -euo pipefail {0}
Expand Down Expand Up @@ -52,6 +55,7 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ vars.TEST_RESULTS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.TEST_RESULTS_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2
BRANCH_NAME: ${{ github.event.workflow_run.head_branch }}
if: env.S3_BUCKET != '' && env.AWS_ACCESS_KEY_ID != '' && env.AWS_SECRET_ACCESS_KEY != ''
shell: bash --noprofile --norc -euo pipefail {0}
run: |
Expand Down Expand Up @@ -92,9 +96,10 @@ jobs:
continue;
fi
jq -c \
--argjson addObj '{"branch":"${{ github.event.workflow_run.head_branch }}","git_sha":"${{ github.event.workflow_run.head_sha }}","workflow_name":"${{ github.event.workflow.name }}","workflow_run":"${{ github.event.workflow_run.id }}","workflow_conclusion":"${{ github.event.workflow_run.conclusion }}","workflow_job":"","workflow_run_attempt":"${{ github.event.workflow_run.run_attempt }}","timestamp":""}' \
--argjson addObj '{"branch":"","git_sha":"${{ github.event.workflow_run.head_sha }}","workflow_name":"${{ github.event.workflow.name }}","workflow_run":"${{ github.event.workflow_run.id }}","workflow_conclusion":"${{ github.event.workflow_run.conclusion }}","workflow_job":"","workflow_run_attempt":"${{ github.event.workflow_run.run_attempt }}","timestamp":""}' \
--arg timestamp "$(date -u '+%F %T.%3NZ')" \
'. + $addObj | .timestamp=$timestamp' "$filename" | gzip -c > "$artifact_id"
--arg branch "$BRANCH_NAME" \
'. + $addObj | .branch=$branch | .timestamp=$timestamp' "$filename" | gzip -c > "$artifact_id"
aws s3 cp --no-progress "$artifact_id" "s3://$S3_BUCKET/tests/results/type=$(basename "$filename" .ndjson)/repo=$(basename "${{ github.repository }}")/date_created=$(date -u '+%Y-%m-%d')/$artifact_id"
done
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22
23
6 changes: 6 additions & 0 deletions .mvn/modernizer/violations.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@
<comment>Use AssertJ's assertThatThrownBy, see https://github.com/trinodb/trino/issues/5320 for rationale</comment>
</violation>

<violation>
<name>com/amazonaws/services/glue/model/Table.getStorageDescriptor:()Lcom/amazonaws/services/glue/model/StorageDescriptor;</name>
<version>1.1</version>
<comment>Storage descriptor is nullable in Glue model, which is too easy to forget about. Prefer GlueToTrinoConverter.getStorageDescriptor</comment>
</violation>

<violation>
<name>com/amazonaws/services/glue/model/Table.getTableType:()Ljava/lang/String;</name>
<version>1.1</version>
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Trino supports [reproducible builds](https://reproducible-builds.org) as of vers
## Build requirements

* Mac OS X or Linux
* Java 22.0.0+, 64-bit
* Java 23.0.0+, 64-bit
* Docker
* Turn SELinux or other systems disabling write access to the local checkout
off, to allow containers to mount parts of the Trino source tree
Expand Down Expand Up @@ -90,8 +90,8 @@ After opening the project in IntelliJ, double check that the Java SDK is
properly configured for the project:

* Open the File menu and select Project Structure
* In the SDKs section, ensure that JDK 22 is selected (create one if none exist)
* In the Project section, ensure the Project language level is set to 22
* In the SDKs section, ensure that JDK 23 is selected (create one if none exist)
* In the Project section, ensure the Project language level is set to 23

### Running a testing server

Expand Down
4 changes: 2 additions & 2 deletions client/trino-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.trino</groupId>
<artifactId>trino-root</artifactId>
<version>462-SNAPSHOT</version>
<version>465-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand All @@ -15,7 +15,7 @@
<properties>
<project.build.targetJdk>8</project.build.targetJdk>
<main-class>io.trino.cli.Trino</main-class>
<dep.jline.version>3.27.0</dep.jline.version>
<dep.jline.version>3.27.1</dep.jline.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public class ClientOptions
public boolean disableCompression;

@PropertyMapping(ENCODING)
@Option(names = "--encoding", paramLabel = "<encoding>", description = "Experimental spooled protocol encoding [available: ${ENCODINGS}]")
@Option(names = "--encoding", paramLabel = "<encoding>", description = "Experimental spooled protocol encoding [available: ${ENCODINGS}, default: " + DEFAULT_VALUE + "]", defaultValue = "${PREFERRED_ENCODINGS}")
public Optional<String> encoding = Optional.empty();

@Option(names = "--editing-mode", paramLabel = "<editing-mode>", defaultValue = "EMACS", description = "Editing mode [${COMPLETION-CANDIDATES}] " + DEFAULT_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static String formatDataSize(DataSize size, boolean longForm, boolean dec
public static String formatDataRate(DataSize dataSize, Duration duration, boolean longForm, boolean decimalDataSize)
{
long rate = Math.round(dataSize.toBytes() / duration.getValue(SECONDS));
if (Double.isNaN(rate) || Double.isInfinite(rate)) {
if (rate == Long.MAX_VALUE) {
rate = 0;
}

Expand Down
8 changes: 2 additions & 6 deletions client/trino-cli/src/main/java/io/trino/cli/NullPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ public class NullPrinter
implements OutputPrinter
{
@Override
public void printRows(List<List<?>> rows, boolean complete)
{
}
public void printRows(List<List<?>> rows, boolean complete) {}

@Override
public void finish()
{
}
public void finish() {}
}
2 changes: 2 additions & 0 deletions client/trino-cli/src/main/java/io/trino/cli/Trino.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import static com.google.common.base.Strings.emptyToNull;
import static com.google.common.base.Throwables.getStackTraceAsString;
import static io.trino.cli.ClientOptions.DEBUG_OPTION_NAME;
import static io.trino.client.spooling.encoding.QueryDataDecoders.getPreferredEncodings;
import static io.trino.client.spooling.encoding.QueryDataDecoders.getSupportedEncodings;
import static java.lang.System.getenv;
import static java.util.Collections.enumeration;
Expand Down Expand Up @@ -138,6 +139,7 @@ public TrinoResourceBundle()
{
this.variables = ImmutableMap.<String, String>builder()
.put("ENCODINGS", Joiner.on(", ").join(getSupportedEncodings()))
.put("PREFERRED_ENCODINGS", getPreferredEncodings())
.buildOrThrow();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.cli;

import io.airlift.units.DataSize;
import io.airlift.units.Duration;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -418,9 +419,8 @@ public void testFormatDataRateDecimal()
assertThat(formatDataRate(ofBytes(8640000), Duration.valueOf("10d"), false, true)).isEqualTo("10B");
assertThat(formatDataRate(ofBytes(8640000), Duration.valueOf("10d"), true, true)).isEqualTo("10B/s");

// Currently, these tests fail due to https://github.com/trinodb/trino/issues/13093
// assertThat(FormatUtils.formatDataRate(DataSize.ofBytes(1), Duration.valueOf("0s"), false)).isEqualTo("0B");
// assertThat(FormatUtils.formatDataRate(DataSize.ofBytes(1), Duration.valueOf("0s"), true)).isEqualTo("0B/s");
assertThat(FormatUtils.formatDataRate(DataSize.ofBytes(1), Duration.valueOf("0s"), false, true)).isEqualTo("0B");
assertThat(FormatUtils.formatDataRate(DataSize.ofBytes(1), Duration.valueOf("0s"), true, true)).isEqualTo("0B/s");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import io.trino.client.Column;
import io.trino.client.JsonCodec;
import io.trino.client.QueryResults;
import io.trino.client.RawQueryData;
import io.trino.client.StatementStats;
import io.trino.client.TypedQueryData;
import io.trino.client.uri.PropertyName;
import io.trino.client.uri.TrinoUri;
import okhttp3.mockwebserver.MockResponse;
Expand Down Expand Up @@ -136,7 +136,7 @@ static String createResults(MockWebServer server)
null,
null,
ImmutableList.of(new Column("_col0", BIGINT, new ClientTypeSignature(BIGINT))),
RawQueryData.of(ImmutableList.of(ImmutableList.of(123))),
TypedQueryData.of(ImmutableList.of(ImmutableList.of(123))),
StatementStats.builder()
.setState("FINISHED")
.setProgressPercentage(OptionalDouble.empty())
Expand Down
2 changes: 1 addition & 1 deletion client/trino-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.trino</groupId>
<artifactId>trino-root</artifactId>
<version>462-SNAPSHOT</version>
<version>465-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,24 @@ public final class JsonDecodingUtils
{
private JsonDecodingUtils() {}

private static final BigIntegerDecoder BIG_INTEGER_DECODER = new BigIntegerDecoder();
private static final IntegerDecoder INTEGER_DECODER = new IntegerDecoder();
private static final SmallintDecoder SMALLINT_DECODER = new SmallintDecoder();
private static final TinyintDecoder TINYINT_DECODER = new TinyintDecoder();
private static final DoubleDecoder DOUBLE_DECODER = new DoubleDecoder();
private static final RealDecoder REAL_DECODER = new RealDecoder();
private static final BooleanDecoder BOOLEAN_DECODER = new BooleanDecoder();
private static final StringDecoder STRING_DECODER = new StringDecoder();
private static final Base64Decoder BASE_64_DECODER = new Base64Decoder();

public static TypeDecoder[] createTypeDecoders(List<Column> columns)
{
verify(!columns.isEmpty(), "Columns must not be empty");
return columns.stream()
.map(column -> createTypeDecoder(column.getTypeSignature()))
.toArray(TypeDecoder[]::new);
TypeDecoder[] decoders = new TypeDecoder[columns.size()];
for (int i = 0; i < columns.size(); i++) {
decoders[i] = createTypeDecoder(columns.get(i).getTypeSignature());
}
return decoders;
}

public interface TypeDecoder
Expand All @@ -81,19 +93,19 @@ private static TypeDecoder createTypeDecoder(ClientTypeSignature signature)
{
switch (signature.getRawType()) {
case BIGINT:
return new BigIntegerDecoder();
return BIG_INTEGER_DECODER;
case INTEGER:
return new IntegerDecoder();
return INTEGER_DECODER;
case SMALLINT:
return new SmallintDecoder();
return SMALLINT_DECODER;
case TINYINT:
return new TinyintDecoder();
return TINYINT_DECODER;
case DOUBLE:
return new DoubleDecoder();
return DOUBLE_DECODER;
case REAL:
return new RealDecoder();
return REAL_DECODER;
case BOOLEAN:
return new BooleanDecoder();
return BOOLEAN_DECODER;
case ARRAY:
return new ArrayDecoder(signature);
case MAP:
Expand All @@ -115,9 +127,9 @@ private static TypeDecoder createTypeDecoder(ClientTypeSignature signature)
case CHAR:
case GEOMETRY:
case SPHERICAL_GEOGRAPHY:
return new StringDecoder();
return STRING_DECODER;
default:
return new Base64Decoder();
return BASE_64_DECODER;
}
}

Expand All @@ -129,8 +141,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_INT:
return parser.getLongValue();
case VALUE_STRING:
Expand All @@ -149,8 +159,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_INT:
return parser.getIntValue();
case VALUE_STRING:
Expand All @@ -169,8 +177,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_INT:
return parser.getShortValue();
case VALUE_STRING:
Expand All @@ -189,8 +195,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_INT:
return parser.getByteValue();
case VALUE_STRING:
Expand All @@ -209,8 +213,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_FLOAT:
return parser.getDoubleValue();
case VALUE_STRING:
Expand All @@ -229,8 +231,6 @@ public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_NUMBER_FLOAT:
return parser.getFloatValue();
case VALUE_STRING:
Expand All @@ -248,18 +248,7 @@ private static class BooleanDecoder
public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_FALSE:
return false;
case VALUE_TRUE:
return true;
case VALUE_STRING:
return Boolean.parseBoolean(parser.getValueAsString());
default:
throw illegalToken(parser);
}
return parser.getBooleanValue();
}
}

Expand All @@ -270,14 +259,10 @@ private static class StringDecoder
public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_STRING:
return parser.getValueAsString();
default:
throw illegalToken(parser);
if (requireNonNull(parser.currentToken()) != JsonToken.VALUE_STRING) {
throw illegalToken(parser);
}
return parser.getValueAsString();
}
}

Expand All @@ -288,14 +273,7 @@ private static class Base64Decoder
public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case VALUE_NULL:
return null;
case VALUE_STRING:
return Base64.getDecoder().decode(parser.getValueAsString());
default:
throw illegalToken(parser);
}
return Base64.getDecoder().decode(parser.getValueAsString());
}
}

Expand All @@ -315,14 +293,10 @@ public ArrayDecoder(ClientTypeSignature signature)
public Object decode(JsonParser parser)
throws IOException
{
switch (parser.currentToken()) {
case START_ARRAY:
break;
case VALUE_NULL:
return null;
default:
throw illegalToken(parser);
if (requireNonNull(parser.currentToken()) != JsonToken.START_ARRAY) {
throw illegalToken(parser);
}

List<Object> values = new LinkedList<>(); // nulls allowed
while (true) {
switch (parser.nextToken()) {
Expand Down
Loading

0 comments on commit 85f200a

Please sign in to comment.