Skip to content

Commit f8eab28

Browse files
committed
update
1 parent 5187eb1 commit f8eab28

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

parquet-column/src/main/java/org/apache/parquet/column/values/plain/BinaryPlainValuesReader.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@
2727
import org.slf4j.Logger;
2828
import org.slf4j.LoggerFactory;
2929

30+
/**
31+
* ValuesReader for variable-length {@code BYTE_ARRAY} columns.
32+
*
33+
* <p>When the column carries the logical type {@code DECIMAL}, the bytes read
34+
* here are the big-endian two's-complement form of the un-scaled integer.
35+
* It slices the requested number of bytes without flipping and
36+
* returns them as a {@link org.apache.parquet.io.api.Binary}.
37+
*/
3038
public class BinaryPlainValuesReader extends ValuesReader {
3139
private static final Logger LOG = LoggerFactory.getLogger(BinaryPlainValuesReader.class);
3240
private ByteBufferInputStream in;

parquet-column/src/main/java/org/apache/parquet/column/values/plain/PlainValuesWriter.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@
3232
import org.slf4j.LoggerFactory;
3333

3434
/**
35-
* Plain encoding except for booleans
35+
* Plain encoding except for booleans.
36+
*
37+
* <p>Endianness note for DECIMAL: when a DECIMAL value is stored in a
38+
* BYTE_ARRAY column, the {@link org.apache.parquet.io.api.Binary}
39+
* passed to this writer already contains the big-endian two's-complement bytes
40+
* of the un-scaled integer (the same bytes produced by
41+
* {@link java.math.BigInteger#toByteArray()}). This writer keeps those bytes
42+
* exactly as they are and only adds the 4-byte little-endian length prefix
43+
* required by the PLAIN encoding. Bytes are not re-ordered..</p>
3644
*/
3745
public class PlainValuesWriter extends ValuesWriter {
3846
private static final Logger LOG = LoggerFactory.getLogger(PlainValuesWriter.class);

0 commit comments

Comments
 (0)