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
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
public class ProtobufDeserializerFactory
implements LineDeserializerFactory
{
public static final String SERIALIZATION_CLASS = "serialization.class";
private LoadingCache<String, Descriptor> cache;

public ProtobufDeserializerFactory(Path descriptorsDirectory, Duration updateInterval, long maximumSize)
Expand Down Expand Up @@ -80,15 +81,20 @@ public ProtobufDeserializer create(List<Column> columns, Map<String, String> ser
throw new TrinoException(CONFIGURATION_INVALID, "No \"hive.protobufs.descriptors\" set in hive configuration");
}

String serializationClass = serdeProperties.get("serialization.class");
String serializationClass = serdeProperties.get(SERIALIZATION_CLASS);
if (serializationClass == null) {
throw new TrinoException(HIVE_INVALID_METADATA, "Missing serdeproperties key \"serialization.class\"");
}
else if (!serializationClass.matches("^[^$]+\\$[^$]+$")) {
throw new TrinoException(HIVE_INVALID_METADATA, String.format("Expected serialization.class to contain {package}${protoname}, but was %s", serializationClass));
}

return new ProtobufDeserializer(columns, cache.getUnchecked(serializationClass));
return new ProtobufDeserializer(columns, getDescriptor(serializationClass));
}

public Descriptor getDescriptor(String serializationClass)
{
return cache.getUnchecked(serializationClass);
}

private static class DescriptorCacheLoader
Expand Down
Loading
Loading