Skip to content
Merged
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 @@ -21,7 +21,6 @@
import java.util.Set;
import javax.annotation.Nullable;
import org.apache.avro.Schema;
import org.apache.parquet.schema.PrimitiveType;
import org.apache.pinot.plugin.inputformat.avro.AvroRecordExtractor;
import org.apache.pinot.spi.data.readers.RecordExtractorConfig;

Expand All @@ -40,21 +39,26 @@ protected Object transformValue(Object value, Schema.Field field) {

Object handleDeprecatedTypes(Object value, Schema.Field field) {
Schema.Type avroColumnType = field.schema().getType();
if (avroColumnType == org.apache.avro.Schema.Type.UNION) {
org.apache.avro.Schema nonNullSchema = null;
for (org.apache.avro.Schema childFieldSchema : field.schema().getTypes()) {
if (childFieldSchema.getType() != org.apache.avro.Schema.Type.NULL) {
if (avroColumnType == Schema.Type.UNION) {
Schema nonNullSchema = null;
for (Schema childFieldSchema : field.schema().getTypes()) {
if (childFieldSchema.getType() != Schema.Type.NULL) {
if (nonNullSchema == null) {
nonNullSchema = childFieldSchema;
} else {
throw new IllegalStateException("More than one non-null schema in UNION schema");
}
}
}
assert nonNullSchema != null;
Comment thread
Jackie-Jiang marked this conversation as resolved.

//INT96 is deprecated. We convert to long as we do in the native parquet extractor.
if (nonNullSchema.getName().equals(PrimitiveType.PrimitiveTypeName.INT96.name())) {
return ParquetNativeRecordExtractor.convertInt96ToLong((byte[]) value);
// NOTE:
// INT96 is deprecated. We convert to long as we do in the native parquet extractor.
// See org.apache.parquet.avro.AvroSchemaConverter about how INT96 is converted into Avro schema.
// We have to rely on the doc to determine whether a field is INT96.
if (nonNullSchema.getType() == Schema.Type.FIXED && nonNullSchema.getFixedSize() == 12
&& "INT96 represented as byte[12]".equals(nonNullSchema.getDoc())) {
Comment thread
Jackie-Jiang marked this conversation as resolved.
Comment thread
Jackie-Jiang marked this conversation as resolved.
return ParquetNativeRecordExtractor.convertInt96ToLong((byte[]) value);
}
}
return value;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

<arrow.version>18.3.0</arrow.version>
<avro.version>1.12.1</avro.version>
<parquet.version>1.16.0</parquet.version>
<parquet.version>1.17.0</parquet.version>
<orc.version>1.9.8</orc.version>
<hive.version>2.8.1</hive.version>
<helix.version>1.3.2</helix.version>
Expand Down
Loading