Skip to content
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
32 changes: 22 additions & 10 deletions core/trino-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@
<artifactId>jackson-annotations</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
Expand Down Expand Up @@ -388,6 +378,16 @@
<artifactId>jmxutils</artifactId>
</dependency>

<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand All @@ -400,6 +400,18 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
Expand Down
26 changes: 11 additions & 15 deletions core/trino-main/src/main/java/io/trino/block/BlockJsonSerde.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@
*/
package io.trino.block;

import com.fasterxml.jackson.core.Base64Variants;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.google.inject.Inject;
import io.airlift.slice.DynamicSliceOutput;
import io.airlift.slice.Slice;
import io.airlift.slice.SliceOutput;
import io.airlift.slice.Slices;
import io.trino.spi.block.Block;
import io.trino.spi.block.BlockEncodingSerde;

import java.io.IOException;
import tools.jackson.core.Base64Variants;
import tools.jackson.core.JsonGenerator;
import tools.jackson.core.JsonParser;
import tools.jackson.databind.DeserializationContext;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.ValueDeserializer;
import tools.jackson.databind.ValueSerializer;

import static io.trino.block.BlockSerdeUtil.readBlock;
import static io.trino.block.BlockSerdeUtil.writeBlock;
Expand All @@ -40,7 +38,7 @@ public final class BlockJsonSerde
private BlockJsonSerde() {}

public static class Serializer
extends JsonSerializer<Block>
extends ValueSerializer<Block>
{
private final BlockEncodingSerde blockEncodingSerde;

Expand All @@ -51,8 +49,7 @@ public Serializer(BlockEncodingSerde blockEncodingSerde)
}

@Override
public void serialize(Block block, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
throws IOException
public void serialize(Block block, JsonGenerator jsonGenerator, SerializationContext context)
{
SliceOutput output = new DynamicSliceOutput(toIntExact(blockEncodingSerde.estimatedWriteSize(block)));
writeBlock(blockEncodingSerde, output, block);
Expand All @@ -62,7 +59,7 @@ public void serialize(Block block, JsonGenerator jsonGenerator, SerializerProvid
}

public static class Deserializer
extends JsonDeserializer<Block>
extends ValueDeserializer<Block>
{
private final BlockEncodingSerde blockEncodingSerde;

Expand All @@ -73,8 +70,7 @@ public Deserializer(BlockEncodingSerde blockEncodingSerde)
}

@Override
public Block deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException
public Block deserialize(JsonParser jsonParser, DeserializationContext context)
{
byte[] decoded = jsonParser.getBinaryValue(Base64Variants.MIME_NO_LINEFEEDS);
return readBlock(blockEncodingSerde, Slices.wrappedBuffer(decoded));
Expand Down
116 changes: 12 additions & 104 deletions core/trino-main/src/main/java/io/trino/json/JsonEmptySequenceNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,130 +13,40 @@
*/
package io.trino.json;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonPointer;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import com.fasterxml.jackson.databind.node.JsonNodeType;

import java.io.IOException;
import java.util.List;
import tools.jackson.core.JsonGenerator;
import tools.jackson.core.JsonToken;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.jsontype.TypeSerializer;
import tools.jackson.databind.node.JsonNodeType;
import tools.jackson.databind.node.ValueNode;

public class JsonEmptySequenceNode
extends JsonNode
extends ValueNode
{
public static final JsonEmptySequenceNode EMPTY_SEQUENCE = new JsonEmptySequenceNode();

private JsonEmptySequenceNode() {}

@Override
public <T extends JsonNode> T deepCopy()
{
throw new UnsupportedOperationException();
}

@Override
public JsonToken asToken()
{
throw new UnsupportedOperationException();
}

@Override
public JsonParser.NumberType numberType()
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode get(int index)
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode path(String fieldName)
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode path(int index)
{
throw new UnsupportedOperationException();
}

@Override
public JsonParser traverse()
{
throw new UnsupportedOperationException();
}

@Override
public JsonParser traverse(ObjectCodec codec)
{
throw new UnsupportedOperationException();
}

@Override
protected JsonNode _at(JsonPointer ptr)
{
throw new UnsupportedOperationException();
}

@Override
public JsonNodeType getNodeType()
{
throw new UnsupportedOperationException();
}

@Override
public String asText()
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode findValue(String fieldName)
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode findPath(String fieldName)
{
throw new UnsupportedOperationException();
}

@Override
public JsonNode findParent(String fieldName)
{
throw new UnsupportedOperationException();
}

@Override
public List<JsonNode> findValues(String fieldName, List<JsonNode> foundSoFar)
{
throw new UnsupportedOperationException();
}

@Override
public List<String> findValuesAsText(String fieldName, List<String> foundSoFar)
{
throw new UnsupportedOperationException();
}

@Override
public List<JsonNode> findParents(String fieldName, List<JsonNode> foundSoFar)
public String toString()
{
throw new UnsupportedOperationException();
return "EMPTY_SEQUENCE";
}

@Override
public String toString()
protected String _valueDesc()
{
return "EMPTY_SEQUENCE";
}
Expand All @@ -154,15 +64,13 @@ public int hashCode()
}

@Override
public void serialize(JsonGenerator gen, SerializerProvider serializers)
throws IOException
public void serialize(JsonGenerator gen, SerializationContext context)
{
throw new UnsupportedOperationException();
}

@Override
public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer)
throws IOException
public void serializeWithType(JsonGenerator gen, SerializationContext context, TypeSerializer typeSer)
{
throw new UnsupportedOperationException();
}
Expand Down
Loading
Loading