snleee commented on code in PR #11840:
URL: https://github.com/apache/pinot/pull/11840#discussion_r1367212488
##########
pinot-plugins/pinot-input-format/pinot-parquet/src/main/java/org/apache/pinot/plugin/inputformat/parquet/ParquetNativeRecordExtractor.java:
##########
@@ -143,14 +142,26 @@ private Object extractValue(Group from, int fieldIndex) {
}
private Object extractValue(Group from, int fieldIndex, Type fieldType, int
index) {
- OriginalType originalType = fieldType.getOriginalType();
+ LogicalTypeAnnotation logicalTypeAnnotation =
fieldType.getLogicalTypeAnnotation();
if (fieldType.isPrimitive()) {
PrimitiveType.PrimitiveTypeName primitiveTypeName =
fieldType.asPrimitiveType().getPrimitiveTypeName();
switch (primitiveTypeName) {
case INT32:
- return from.getInteger(fieldIndex, index);
+ int intValue = from.getInteger(fieldIndex, index);
+ if (logicalTypeAnnotation instanceof
LogicalTypeAnnotation.DecimalLogicalTypeAnnotation) {
Review Comment:
we can do the following:
```
if (logicalTypeAnnotation.getType() == LogicalTypeToken.DECIMAL)
```
##########
pinot-plugins/pinot-input-format/pinot-parquet/src/main/java/org/apache/pinot/plugin/inputformat/parquet/ParquetNativeRecordExtractor.java:
##########
@@ -160,34 +171,32 @@ private Object extractValue(Group from, int fieldIndex,
Type fieldType, int inde
case INT96:
Binary int96 = from.getInt96(fieldIndex, index);
ByteBuffer buf =
ByteBuffer.wrap(int96.getBytes()).order(ByteOrder.LITTLE_ENDIAN);
- long dateTime = (buf.getInt(8) - JULIAN_DAY_NUMBER_FOR_UNIX_EPOCH) *
DateTimeConstants.MILLIS_PER_DAY
+ return (buf.getInt(8) - JULIAN_DAY_NUMBER_FOR_UNIX_EPOCH) *
DateTimeConstants.MILLIS_PER_DAY
+ buf.getLong(0) / NANOS_PER_MILLISECOND;
- return dateTime;
case BINARY:
case FIXED_LEN_BYTE_ARRAY:
- if (originalType != null) {
- switch (originalType) {
- case UTF8:
- case ENUM:
- return from.getValueToString(fieldIndex, index);
- case DECIMAL:
- DecimalMetadata decimalMetadata =
fieldType.asPrimitiveType().getDecimalMetadata();
- return binaryToDecimal(from.getBinary(fieldIndex, index),
decimalMetadata.getPrecision(),
- decimalMetadata.getScale());
- default:
- break;
- }
+ if (logicalTypeAnnotation instanceof
LogicalTypeAnnotation.DecimalLogicalTypeAnnotation) {
Review Comment:
Similarly, we can do:
```
switch(logicalTypeAnnotation.getType()) {
case DECIMAL:
case STRING:
case ENUM:
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]