bryanck commented on code in PR #5168:
URL: https://github.com/apache/iceberg/pull/5168#discussion_r913077062
##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDictionaryEncodedParquetValuesReader.java:
##########
@@ -128,12 +128,11 @@ protected void nextVal(FieldVector vector, Dictionary
dict, int idx, int current
class FixedLengthDecimalDictEncodedReader extends BaseDictEncodedReader {
@Override
protected void nextVal(FieldVector vector, Dictionary dict, int idx, int
currentVal, int typeWidth) {
- byte[] decimalBytes = dict.decodeToBinary(currentVal).getBytesUnsafe();
- byte[] vectorBytes = new byte[typeWidth];
- System.arraycopy(decimalBytes, 0, vectorBytes, 0, typeWidth);
+ byte[] vectorBytes =
+ DecimalVectorUtil.padBigEndianBytes(
+ dict.decodeToBinary(currentVal).getBytesUnsafe(),
+ DecimalVector.TYPE_WIDTH);
Review Comment:
`typeWidth` is the Parquet width, I believe, which is variable depending on
the scale of the decimal, but the Arrow width is always 16.
##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/parquet/VectorizedDictionaryEncodedParquetValuesReader.java:
##########
@@ -128,12 +128,11 @@ protected void nextVal(FieldVector vector, Dictionary
dict, int idx, int current
class FixedLengthDecimalDictEncodedReader extends BaseDictEncodedReader {
@Override
protected void nextVal(FieldVector vector, Dictionary dict, int idx, int
currentVal, int typeWidth) {
- byte[] decimalBytes = dict.decodeToBinary(currentVal).getBytesUnsafe();
- byte[] vectorBytes = new byte[typeWidth];
- System.arraycopy(decimalBytes, 0, vectorBytes, 0, typeWidth);
+ byte[] vectorBytes =
+ DecimalVectorUtil.padBigEndianBytes(
+ dict.decodeToBinary(currentVal).getBytesUnsafe(),
+ DecimalVector.TYPE_WIDTH);
Review Comment:
I believe so, for Decimal it looked like it was always set to 16.
--
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]