Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Aug 4, 2023
1 parent 0ab4866 commit 1fedb56
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 36 deletions.
42 changes: 22 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.ebyhr</groupId>
<artifactId>trino-storage</artifactId>
<version>421-SNAPSHOT</version>
<version>422-SNAPSHOT</version>
<description>Trino - Storage Connector</description>
<packaging>trino-plugin</packaging>

Expand All @@ -16,7 +16,7 @@
<parent>
<groupId>io.airlift</groupId>
<artifactId>airbase</artifactId>
<version>138</version>
<version>143</version>
</parent>

<licenses>
Expand All @@ -37,15 +37,15 @@
<air.check.fail-checkstyle>true</air.check.fail-checkstyle>
<air.check.skip-checkstyle>false</air.check.skip-checkstyle>

<dep.trino.version>420</dep.trino.version>
<dep.airlift.version>233</dep.airlift.version>
<dep.trino.version>422</dep.trino.version>
<dep.airlift.version>234</dep.airlift.version>
<dep.packaging.version>${dep.airlift.version}</dep.packaging.version>
<dep.aws-sdk.version>1.12.477</dep.aws-sdk.version>
<dep.errorprone.version>2.20.0</dep.errorprone.version>
<dep.jackson.version>2.15.1</dep.jackson.version>
<dep.aws-sdk.version>1.12.522</dep.aws-sdk.version>
<dep.errorprone.version>2.21.0</dep.errorprone.version>
<dep.jackson.version>2.15.2</dep.jackson.version>
<dep.testcontainers.version>1.18.3</dep.testcontainers.version>
<dep.docker-java.version>3.3.0</dep.docker-java.version>
<dep.testng.version>7.7.1</dep.testng.version>
<dep.docker-java.version>3.3.2</dep.docker-java.version>
<dep.testng.version>7.8.0</dep.testng.version>
<dep.joda.version>2.12.5</dep.joda.version>
<dep.opentelemetry.version>1.26.0</dep.opentelemetry.version>
<dep.opentelemetry-instrumentation.version>1.25.1</dep.opentelemetry-instrumentation.version>
Expand Down Expand Up @@ -76,7 +76,17 @@
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.14.4</version>
<version>1.14.5</version>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>slice</artifactId>
<version>0.45</version>
</dependency>
<dependency>
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<version>0.17</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down Expand Up @@ -205,7 +215,7 @@
<groupId>io.trino.hadoop</groupId>
<artifactId>hadoop-apache</artifactId>
<scope>runtime</scope>
<version>3.2.0-18</version>
<version>3.3.5-1</version>
</dependency>

<dependency>
Expand All @@ -229,7 +239,7 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>units</artifactId>
<version>1.8</version>
<version>1.10</version>
<scope>runtime</scope>
</dependency>

Expand Down Expand Up @@ -258,7 +268,6 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>slice</artifactId>
<version>0.45</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -287,7 +296,6 @@
<groupId>org.openjdk.jol</groupId>
<artifactId>jol-core</artifactId>
<scope>provided</scope>
<version>0.17</version>
</dependency>

<!-- for testing -->
Expand Down Expand Up @@ -361,12 +369,6 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down
40 changes: 25 additions & 15 deletions src/main/java/org/ebyhr/trino/storage/operator/JsonPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.airlift.slice.Slice;
import io.trino.spi.TrinoException;
import io.trino.spi.block.BlockBuilder;
import io.trino.spi.block.RowBlockBuilder;
import io.trino.spi.type.ArrayType;
import io.trino.spi.type.BooleanType;
import io.trino.spi.type.RowType;
Expand All @@ -34,6 +35,7 @@
import java.io.UncheckedIOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -150,35 +152,43 @@ private List<?> nodeToRow(JsonNode node)

private Object mapValue(JsonNode node)
{
BlockBuilder values;
switch (node.getNodeType()) {
case ARRAY:
case ARRAY -> {
Iterator<JsonNode> elements = node.elements();
if (!elements.hasNext()) {
throw new VerifyException("Cannot infer the SQL type of an empty JSON array");
}
Type type = mapType(elements.next());
values = type.createBlockBuilder(null, 10);
BlockBuilder values = type.createBlockBuilder(null, 10);
node.elements().forEachRemaining(value -> writeObject(values, value));
return values.build();
case BOOLEAN:
}
case BOOLEAN -> {
return node.asBoolean();
case NUMBER:
}
case NUMBER -> {
return node.canConvertToLong() ? node.asLong() : node.asDouble();
case OBJECT:
}
case OBJECT -> {
Type rowType = mapType(node);
values = rowType.createBlockBuilder(null, 10);
BlockBuilder rowBuilder = values.beginBlockEntry();
node.fields().forEachRemaining(field -> writeObject(rowBuilder, field.getValue()));
values.closeEntry();
return rowType.getObject(values, values.getPositionCount() - 1);
case NULL:
RowBlockBuilder rowBlockBuilder = (RowBlockBuilder) rowType.createBlockBuilder(null, 10);
rowBlockBuilder.buildEntry(elementBuilder -> {
Iterator<Map.Entry<String, JsonNode>> fields = node.fields();
for (int i = 0; fields.hasNext(); i++) {
writeObject(elementBuilder.get(i), fields.next().getValue());
}
});
return rowType.getObject(rowBlockBuilder, rowBlockBuilder.getPositionCount() - 1);
}
case NULL -> {
return null;
case STRING:
}
case STRING -> {
return node.asText();
default:
}
default ->
// BINARY, MISSING, POJO
throw new VerifyException("Unhandled JSON type: " + node.getNodeType());
throw new VerifyException("Unhandled JSON type: " + node.getNodeType());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class TestingHadoopServer

public TestingHadoopServer(Network network)
{
dockerContainer = new GenericContainer<>(DockerImageName.parse("ghcr.io/trinodb/testing/hdp2.6-hive:65"))
dockerContainer = new GenericContainer<>(DockerImageName.parse("ghcr.io/trinodb/testing/hdp2.6-hive:82"))
.withCreateContainerCmdModifier(cmd -> cmd.withHostName(HOSTNAME))
.withCopyFileToContainer(MountableFile.forClasspathResource("minio/hive-core-site.xml"), "/etc/hadoop/conf/core-site.xml")
.withStartupCheckStrategy(new IsRunningStartupCheckStrategy())
Expand Down

0 comments on commit 1fedb56

Please sign in to comment.