in orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java [107:167]
public OrcValueReader<?> primitive(Type.PrimitiveType iPrimitive, TypeDescription primitive) {
if (iPrimitive == null) {
return null;
}
switch (primitive.getCategory()) {
case BOOLEAN:
return OrcValueReaders.booleans();
case BYTE:
// Iceberg does not have a byte type. Use int
case SHORT:
// Iceberg does not have a short type. Use int
case INT:
return OrcValueReaders.ints();
case LONG:
switch (iPrimitive.typeId()) {
case TIME:
return GenericOrcReaders.times();
case LONG:
return OrcValueReaders.longs();
default:
throw new IllegalStateException(
String.format(
"Invalid iceberg type %s corresponding to ORC type %s",
iPrimitive, primitive));
}
case FLOAT:
return OrcValueReaders.floats();
case DOUBLE:
return OrcValueReaders.doubles();
case DATE:
return GenericOrcReaders.dates();
case TIMESTAMP:
return GenericOrcReaders.timestamps();
case TIMESTAMP_INSTANT:
return GenericOrcReaders.timestampTzs();
case DECIMAL:
return GenericOrcReaders.decimals();
case CHAR:
case VARCHAR:
case STRING:
return GenericOrcReaders.strings();
case BINARY:
switch (iPrimitive.typeId()) {
case UUID:
return GenericOrcReaders.uuids();
case FIXED:
return OrcValueReaders.bytes();
case BINARY:
return GenericOrcReaders.bytes();
default:
throw new IllegalStateException(
String.format(
"Invalid iceberg type %s corresponding to ORC type %s",
iPrimitive, primitive));
}
default:
throw new IllegalArgumentException("Unhandled type " + primitive);
}
}