@Override protected void readField(long recordsToReadInThisPass) { recordsReadInThisIteration = Math.min(pageReader.currentPageCount - pageReader.valuesRead, recordsToReadInThisPass - valuesReadInCurrentPass); if (usingDictionary) { for (int i = 0; i < recordsReadInThisIteration; i++){ BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.dictionaryValueReader.readInteger())); DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } } } }
@Override protected void readField(long recordsToReadInThisPass) { recordsReadInThisIteration = Math.min(pageReader.currentPageCount - pageReader.valuesRead, recordsToReadInThisPass - valuesReadInCurrentPass); for (int i = 0; i < recordsReadInThisIteration; i++){ try { BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.dictionaryValueReader.readLong())); DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } catch ( Exception ex) { throw ex; } } } }
@Override protected void readField(long recordsToReadInThisPass) { if (usingDictionary) { for (int i = 0; i < recordsToReadInThisPass; i++){ BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.dictionaryValueReader.readInteger())); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } } else { for (int i = 0; i < recordsToReadInThisPass; i++){ BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.valueReader.readInteger())); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } } } }
@Override protected void readField(long recordsToReadInThisPass) { if (usingDictionary) { for (int i = 0; i < recordsToReadInThisPass; i++){ BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.dictionaryValueReader.readLong())); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } } else { for (int i = 0; i < recordsToReadInThisPass; i++){ BigDecimal bigDecimal = new BigDecimal(BigInteger.valueOf(pageReader.valueReader.readLong())); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(bigDecimal, vectorData, valuesReadInCurrentPass + i); valueVec.setIndexDefined(valuesReadInCurrentPass + i); } } } }
@Override void addNext(int start, int index) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, valueVec.getDataBuffer(), index); valueVec.setIndexDefined(index); } }
@Override void addNext(int start, int index) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, valueVec.getDataBuffer(), index); valueVec.setIndexDefined(index); } }
@Override public boolean setSafe(int index, ArrowBuf bytebuf, int start, int length) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); if (index >= decimalVector.getValueCapacity()) { return false; } /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, decimalVector.getDataBuffer(), index); decimalVector.setIndexDefined(index); return true; }
@Override public boolean setSafe(int index, ArrowBuf bytebuf, int start, int length) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); if (index >= decimalVector.getValueCapacity()) { return false; } /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, decimalVector.getDataBuffer(), index); decimalVector.setIndexDefined(index); return true; }