Part 3 · Parquet and columnar files · Chapter 6
Parquet encodings and compression
Every encoding in the spec, with worked bytes: PLAIN, the RLE/bit-packing hybrid, dictionary, DELTA_BINARY_PACKED, DELTA_LENGTH_BYTE_ARRAY, DELTA_BYTE_ARRAY, BYTE_STREAM_SPLIT, and how compression codecs layer on top. With measured sizes for each encoding and codec.
After this chapter you should be able to:
- Encode a small column by hand in each encoding.
- Explain when parquet-java and Arrow fall back from dictionary encoding, and to what.
- Predict which encoding and codec make a given column smallest, and why.
Chapter 5 treated a page body as “levels, then values”. This chapter opens the values. Parquet stores each page’s values in one of seven encodings, and then optionally compresses the whole page body with a general-purpose codec. The encoding uses what the writer knows about the column (its type, its distinct values, whether it is sorted); the codec sees only bytes. Getting the encoding right often matters more than the codec, and the two interact: some encodings make the codec’s job easier, and one (BYTE_STREAM_SPLIT) exists only for that.
Each page header names its encoding in DataPageHeader.encoding, and the column chunk’s ColumnMetaData.encodings lists every encoding used in the chunk, so a reader knows what decoder it needs before it reads a page.[parquet.thrift] The spec lists which encodings apply to which physical types:[Encodings.md]
| Encoding | Id | Types |
|---|---|---|
| PLAIN | 0 | all |
| PLAIN_DICTIONARY (deprecated), RLE_DICTIONARY | 2, 8 | all |
| RLE (the RLE/bit-packing hybrid) | 3 | BOOLEAN, and levels and dictionary indices |
| DELTA_BINARY_PACKED | 5 | INT32, INT64 |
| DELTA_LENGTH_BYTE_ARRAY | 6 | BYTE_ARRAY |
| DELTA_BYTE_ARRAY | 7 | BYTE_ARRAY, FIXED_LEN_BYTE_ARRAY |
| BYTE_STREAM_SPLIT | 9 | INT32, INT64, FLOAT, DOUBLE, FIXED_LEN_BYTE_ARRAY |
| ALP (preview) | 10 | FLOAT, DOUBLE |
BIT_PACKED (4) is deprecated and only ever applied to levels. Every encoder in this chapter is implemented in src/sim/parquet/encodings.ts, tested against the spec’s worked examples, and checked both ways against Arrow C++ 26.0.1: pyarrow reads files the book’s writer produces in each encoding, and the book’s reader decodes files pyarrow wrote.
PLAIN
PLAIN “must be supported for types” and stores values back to back: INT32 as 4 bytes little endian, INT64 and DOUBLE as 8, FLOAT as 4 IEEE bytes, FIXED_LEN_BYTE_ARRAY as its raw bytes, BOOLEAN bit-packed LSB first, and BYTE_ARRAY as “length in 4 bytes little endian followed by the bytes contained in the array”.[Encodings.md]
INT64 1001, 1002 e9 03 00 00 00 00 00 00 ea 03 00 00 00 00 00 00
BYTE_ARRAY "ab", "c" 02 00 00 00 61 62 01 00 00 00 63
PLAIN is also the format of every dictionary page, and the fallback when a better encoding gives up. Its costs are easy to see: an 8-byte integer column of small, sorted values spends most of its bytes on zeros, and a column of short strings spends 4 bytes per value on lengths.
Q1. How does PLAIN encode the BYTE_ARRAY values "ab", "c"?
RLE / bit-packing hybrid
Before the value encodings, the one every page uses. Definition levels, repetition levels and dictionary indices are small integers with a known maximum, so they are stored at a fixed bit width (1 bit for a flat optional column’s definition levels) in a hybrid of two run types:[Encodings.md]
rle-bit-packed-hybrid: <length> <encoded-data>
encoded-data := <run>*
run := <bit-packed-run> | <rle-run>
bit-packed-header := varint-encode(<bit-pack-scaled-run-len> << 1 | 1)
bit-pack-scaled-run-len := (bit-packed-run-len) / 8
rle-header := varint-encode( (rle-run-len) << 1)
repeated-value := value that is repeated, using a fixed-width of round-up-to-next-byte(bit-width)
The low bit of the header picks the run type. An RLE run is a count and one value padded to whole bytes. A bit-packed run is a count of 8-value groups and then the values packed “from the least significant bit of each byte to the most significant bit”. The spec’s example packs 0 to 7 at width 3 into three bytes, 10001000 11000110 11111010. The <length> prefix is 4 bytes and appears only for levels and booleans in data page v1 (and booleans in v2); dictionary indices never have it, and v2 levels lose it because DataPageHeaderV2 carries their byte lengths.
The spec fixes the format; the encoder decides when to use which run. parquet-java’s RunLengthBitPackingHybridEncoder buffers values in groups of 8. While a value repeats, it counts; once the count reaches 8 it stops buffering and the run will be written as RLE. When a different value arrives after at least 8 repeats, the RLE run is written. Otherwise each full group of 8 is appended to the current bit-packed run, and a bit-packed run is closed after 63 groups so its header fits in one byte:[parquet-java]
public void writeInt(int value) throws IOException {
if (value == previousValue) {
++repeatCount;
if (repeatCount >= 8) {
// we've seen this at least 8 times, we're certainly going to write an rle-run,
// so just keep on counting repeats for now
return;
}
} else {
// This is a new value, check if it signals the end of an rle-run
if (repeatCount >= 8) {
writeRleRun();
}
repeatCount = 1;
previousValue = value;
}
bufferedValues[numBufferedValues] = value;
++numBufferedValues;
if (numBufferedValues == 8) {
// we've encountered less than 8 repeated values, so
// either start a new bit-packed-run or append to the current bit-packed-run
writeOrAppendBitPackedRun();
}
}
The book’s encoder is a line-by-line port. Three cases from it, at the bit widths a real page would use:
fare definition levels 1,1,1,0 (width 1) 03 07 bit-packed, 1 group: 0b00000111 (padded with zeros)
ten nulls 0 × 10 (width 1) 14 00 RLE: 10 << 1 = 0x14, value 0
3 ×12, then 1,2,1,2,1,2,1,2, then 0 ×9 18 03 03 99 99 12 00
(width 2) RLE 12×3 | bit-packed 1 group | RLE 9×0
The first line is what chapter 5’s sample file now holds for every fare page with one null: a 4-byte length (02 00 00 00) then 03 07. Note that a short run is never worth a separate RLE run: the 6 repeats in 5,5,5,5,5,5,x,y cost 6 × width bits inside a bit-packed group, which is less than a header and a value.
Q1. In the RLE/bit-packing hybrid, what does the lowest bit of a run header mean?
Q2. parquet-java's hybrid encoder sees the value 5 repeated 6 times, then other values. What does it write for those six 5s?
Q3. Where does a v1 data page use the RLE/bit-packing hybrid? (Select all.) (select all that apply)
Dictionary encoding
Dictionary encoding replaces each value with a small integer id. A dictionary page at the start of the column chunk holds the distinct values in PLAIN encoding; each data page holds “the bit width used to encode the entry ids stored as 1 byte (max bit width = 32), followed by the values encoded using the RLE/Bit-Packing described above”.[Encodings.md] Writers assign ids in first-seen order (parquet-java, Arrow and the book’s encoder all do), and the bit width is that of the largest id.
0.[Parquet encodings] With three cities, ids 0 to 2 need 2 bits. The first city page of the sample file (Austin, Austin, Austin, Boston) encodes its values in these bytes.
02 bit width 2
03 40 00 bit-packed, 1 group: ids 0,0,0,1 then 4 padding zeros, 2 bits each
Three bytes instead of 4 × (4 + 6) = 40 for PLAIN. Two enum values name this encoding. “Using the PLAIN_DICTIONARY enum value is deprecated, use RLE_DICTIONARY in a data page and PLAIN in a dictionary page for new Parquet files.”[Encodings.md] Writers did not all follow: parquet-java’s v1 values-writer factory, the default, still labels both pages PLAIN_DICTIONARY; its v2 factory uses PLAIN and RLE_DICTIONARY.[V1 factory][V2 factory] Arrow C++ chooses by format version: PLAIN_DICTIONARY only for PARQUET_1_0, otherwise PLAIN and RLE_DICTIONARY, and its default format version is 2.6.[Arrow properties.h][Arrow properties.h] Readers treat the two ids the same way.
When writers give up on the dictionary
The spec says only that “if the dictionary grows too big, whether in size or number of distinct values, the encoding will fall back to the plain encoding”. A chunk has at most one dictionary page (chapter 5), so once a writer falls back, the rest of the chunk’s pages use another encoding, and a chunk can mix dictionary-encoded and non-dictionary pages. The two main writers decide differently.
parquet-java wraps the dictionary writer in a FallbackValuesWriter. It falls back in two cases. During writing, when the dictionary outgrows its page size (1 MiB by default) or the entry count overflows:[DictionaryValuesWriter][ParquetProperties]
public boolean shouldFallBack() {
// if the dictionary reaches the max byte size or the values can not be encoded on 4 bytes anymore.
return dictionaryByteSize > maxDictionaryByteSize || getDictionarySize() > MAX_DICTIONARY_ENTRIES;
}
public boolean isCompressionSatisfying(long rawSize, long encodedSize) {
return (encodedSize + dictionaryByteSize) < rawSize;
}
And once, at the end of the first page, if indices plus dictionary are not smaller than the raw values: “we use the first page to decide if we’re going to use this encoding”.[FallbackValuesWriter] On fallback, fallBackAllValuesTo re-encodes the values buffered so far with the fallback writer. Which writer that is depends on the factory: PLAIN in v1; in v2, DELTA_BINARY_PACKED for INT32 and INT64, DELTA_BYTE_ARRAY for BYTE_ARRAY, and PLAIN for FLOAT and DOUBLE, with BYTE_STREAM_SPLIT replacing the fallback for numeric types when it is enabled per column.[V1 factory][V2 factory] BOOLEAN columns never get a dictionary.
Arrow C++ has no first-page test. After each batch it checks the dictionary’s encoded size against dictionary_pagesize_limit (1 MiB by default) and, when reached, writes the dictionary page, flushes the dictionary-encoded pages it buffered, and continues with PLAIN; the comment says “Only PLAIN encoding is supported for fallback”:[Arrow column_writer.cc][Arrow properties.h]
void CheckDictionarySizeLimit() {
if (!has_dictionary_ || fallback_) {
return;
}
if (current_dict_encoder_->dict_encoded_size() >=
properties_->dictionary_pagesize_limit()) {
FallbackToPlainEncoding();
}
}
The difference is visible in the measurements below. A column of 100,000 distinct random INT64s has an 800 kB dictionary, under Arrow’s limit, so pyarrow keeps it: the chunk is 1,002,890 bytes against 800,165 for PLAIN. parquet-java’s first-page test would have rejected that dictionary.
Q1. Which pair of encodings should a new file use for a dictionary-encoded column?
Q2. When does parquet-java stop dictionary-encoding a column chunk? (Select all.) (select all that apply)
Q3. A column of 100,000 distinct INT64 values (800 kB) is written by pyarrow with default settings. What happens?
Q4. After a dictionary fallback, what do the rest of the chunk's pages use in Arrow C++?
Delta encodings
Three encodings store differences instead of values. All three build on the first.
DELTA_BINARY_PACKED
For INT32 and INT64. The spec adapts it from the binary packing in “Decoding billions of integers per second through vectorization” by D. Lemire and L. Boytsov.[Lemire and Boytsov] A page is a header, then blocks:[Encodings.md]
header: <block size in values> <number of miniblocks in a block> <total value count> <first value>
block: <min delta> <list of bitwidths of miniblocks> <miniblocks>
The block size is a multiple of 128 and each miniblock holds a multiple of 32 values; the counts are ULEB128 varints and the first value and min delta are zigzag varints. To encode a block, the writer:
- Computes the deltas between consecutive values (the first delta of a block is taken against the last value of the previous block, or the header’s first value).
- Takes the block’s minimum delta, the “frame of reference”, and subtracts it from every delta, so all are non-negative.
- Writes the min delta, one bit-width byte per miniblock, and each miniblock’s values bit-packed at that width (LSB first, as in the hybrid).
Overflow “should be allowed and handled as wrapping around in 2’s complement notation”, and the last miniblock is padded to a full miniblock. If the last block needs fewer miniblocks than the header says, their bit-width bytes are still written, should be zero, and have no data behind them; readers “must accept arbitrary values as well” and stop when they have read the total value count. parquet-java uses 128-value blocks of 4 miniblocks.[parquet-java] It writes stale widths for unused miniblocks of the last block; the book’s encoder writes the zeros the spec asks for, and both decode the same.
For the first page of trip_id in the sample file, 1001 to 1008:
80 01 block size 128
04 4 miniblocks
08 8 values
d2 0f first value: zigzag(1001) = 2002
02 min delta: zigzag(1) = 2
00 00 00 00 bit widths: every (delta − 1) is 0, so 0 bits and no data
Eleven bytes against PLAIN’s 64. Any sorted or slowly changing integer column (timestamps, sequence ids, offsets) looks like this: the min delta absorbs the trend and the miniblocks hold only the jitter. Random integers gain nothing, since their deltas are as wide as the values.
DELTA_LENGTH_BYTE_ARRAY
For BYTE_ARRAY: all the lengths, DELTA_BINARY_PACKED, then all the bytes concatenated. The spec’s example “Hello”, “World”, “Foobar”, “ABCDEF” becomes DeltaEncoding(5, 5, 6, 6) followed by "HelloWorldFoobarABCDEF".[Encodings.md] The spec says it “is always preferred over PLAIN for byte array columns”: the lengths shrink from 4 bytes each to a few bits, and the string bytes sit together where a codec can find repeats across values.
DELTA_BYTE_ARRAY
Also called incremental or front coding: each value stores how many leading bytes it shares with the previous value, then its suffix. The prefix lengths are DELTA_BINARY_PACKED, and the suffixes are DELTA_LENGTH_BYTE_ARRAY:[Encodings.md]
"axis", "axle", "babble", "babyhood"
prefix lengths 0, 2, 0, 3 ("" "ax" "" "bab")
suffix lengths 4, 2, 6, 5
suffixes "axislebabbleyhood"
It pays when neighbouring values share prefixes: sorted URLs, file paths, hierarchical keys. In the measurements below, 100,000 sorted URLs take 172 kB in DELTA_BYTE_ARRAY uncompressed, against 4.2 MB in PLAIN and 3.8 MB in DELTA_LENGTH_BYTE_ARRAY.
The delta encodings have fixed costs: a 128-value block header and 32-value miniblocks padded to full width. On tiny pages, like the 4-value pages of chapter 5’s sample file, they can be bigger than PLAIN. The playground below shows both cases.
Q1. What does a DELTA_BINARY_PACKED block contain?
Q2. Values 1001, 1002, …, 1008 encoded as DELTA_BINARY_PACKED (block 128, 4 miniblocks). How many bytes?
Q3. DELTA_BYTE_ARRAY on "axis", "axle", "babble", "babyhood" stores which prefix lengths?
BYTE_STREAM_SPLIT
“This encoding does not reduce the size of the data but can lead to a significantly better compression ratio and speed when a compression algorithm is used afterwards.” For a type of K bytes and N values it writes K streams of N bytes: byte 0 of every value, then byte 1 of every value, and so on.[Encodings.md]
DOUBLE 1.5, 2.5, 3.5
PLAIN 00 00 00 00 00 00 f8 3f 00 00 00 00 00 00 04 40 00 00 00 00 00 00 0c 40
BYTE_STREAM_SPLIT 00 00 00 | 00 00 00 | 00 00 00 | 00 00 00 | 00 00 00 | 00 00 00 | f8 04 0c | 3f 40 40
For floating point data the high bytes (sign, exponent, top of the mantissa) of neighbouring values are often alike while the low bytes look random. Interleaved, the codec sees noise everywhere; split, it sees long stretches of similar bytes in the high streams. The encoding was defined for FLOAT and DOUBLE and now also covers INT32, INT64 and FIXED_LEN_BYTE_ARRAY. Neither parquet-java nor Arrow uses it unless asked: parquet-java has a per-column byte_stream_split flag that is off by default, and pyarrow takes it through column_encoding or use_byte_stream_split.[ParquetProperties]
It is not a universal win for floats. When a float column has few distinct values, whole 8-byte values repeat, and PLAIN keeps them intact for the codec to match; splitting them scatters each repeat across eight streams. Dictionary encoding is the right choice there.
ALP (Adaptive Lossless floating-Point, id 10) is the newest encoding. It converts decimal-like doubles to integers by decimal scaling, then applies frame-of-reference and bit-packing, with exceptions stored separately. It is adapted from “ALP: Adaptive Lossless floating-Point Compression” by Afroozeh, Kuffo and Boncz (SIGMOD 2024). The spec marks it Preview as of 2026-08-01: the format is stable, implementations are in progress, and writers should make it opt-in.[Encodings.md] The book does not implement it.
Q1. BYTE_STREAM_SPLIT writes exactly as many bytes as PLAIN. Why use it?
Q2. In the measurements, fare (a DOUBLE with about 7,500 distinct values) got bigger with BYTE_STREAM_SPLIT + ZSTD than with PLAIN + ZSTD. Why?
Compression
After encoding, a writer may compress each page body with the chunk’s codec (ColumnMetaData.codec). “For all compression codecs except the deprecated LZ4 codec, the raw data of a (data or dictionary) page is fed as-is to the underlying compression library, without any additional framing or padding.” The page header stays uncompressed and records uncompressed_page_size and compressed_page_size, so a reader can allocate both buffers before decompressing.[Compression.md] In a v2 data page the levels are left out of compression, and is_compressed can say the values are not compressed either.[parquet.thrift]
The codecs in the spec:
| Codec | Notes from Compression.md |
|---|---|
| UNCOMPRESSED | no-op |
| SNAPPY | Snappy format; the Snappy library is authoritative |
| GZIP | GZIP (RFC 1952), not zlib or raw deflate; readers should accept multiple members, writers should not write them |
| LZO | interoperable with the LZO library |
| BROTLI | RFC 7932 |
| LZ4 | deprecated: LZ4 with an undocumented Hadoop framing, “emulated with mixed results by parquet-cpp” |
| ZSTD | RFC 8878 |
| LZ4_RAW | the LZ4 block format, without framing |
Because the codec works per page, every page stays independently decodable, and a reader can skip a page (chapter 8’s page index) without decompressing what came before. The cost is that a codec only finds repeats within one page, which is one more reason pages are about 1 MiB rather than 8 KB.
Defaults differ by layer. Arrow C++‘s WriterProperties default to UNCOMPRESSED; pyarrow’s write_table defaults to compression='snappy'; Spark’s spark.sql.parquet.compression.codec defaults to snappy.[Arrow properties.h][pyarrow][Spark SQLConf] Arrow’s own LZ4 compression type writes the LZ4_RAW codec id; the deprecated framed codec is LZ4_HADOOP in Arrow.[Arrow thrift_internal.h]
Q1. What does a Parquet codec compress?
Q2. Which LZ4 codec should a new writer use?
Choosing an encoding
Most of the time the writer chooses. With defaults:
- parquet-java (and Spark, which sets the codec in
prepareWritebut not the writer version) uses the v1 factory: dictionary for every type except BOOLEAN, falling back to PLAIN. Settingparquet.writer.version=v2switches the fallbacks to the delta encodings.[Spark ParquetUtils][ParquetProperties] - Arrow C++ / pyarrow dictionary-encode every column, fall back to PLAIN at 1 MiB of dictionary, and write data page v1.
column_encodingsets a non-dictionary encoding per column (withuse_dictionary=False).
To see what each choice costs, scripts/parquet-encoding-sizes.py writes six synthetic 100,000-row columns with pyarrow 26.0.1, one file per encoding and codec, and records the column chunk’s total_compressed_size. The data is seeded, so the numbers are reproducible. Each codec runs at Arrow’s default level for it, which is why GZIP sometimes beats ZSTD here. Sizes are in kB; the smallest per column is bold.
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 800 | 687 | 759 | 652 | 477 |
| RLE_DICTIONARY | 1,003 | 889 | 963 | 845 | 664 |
| DELTA_BINARY_PACKED | 329 | 328 | 330 | 329 | 328 |
| BYTE_STREAM_SPLIT | 800 | 459 | 406 | 402 | 371 |
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 800 | 800 | 803 | 800 | 801 |
| RLE_DICTIONARY | 1,003 | 1,003 | 1,007 | 995 | 987 |
| DELTA_BINARY_PACKED | 794 | 794 | 796 | 794 | 793 |
| BYTE_STREAM_SPLIT | 800 | 800 | 803 | 786 | 782 |
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 1,050 | 264 | 272 | 141 | 72 |
| RLE_DICTIONARY | 38 | 38 | 38 | 38 | 38 |
| DELTA_LENGTH_BYTE_ARRAY | 691 | 226 | 305 | 145 | 109 |
| DELTA_BYTE_ARRAY | 679 | 256 | 321 | 176 | 137 |
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 4,233 | 402 | 437 | 121 | 206 |
| RLE_DICTIONARY | 3,907 | 452 | 482 | 199 | 263 |
| DELTA_LENGTH_BYTE_ARRAY | 3,837 | 399 | 438 | 120 | 200 |
| DELTA_BYTE_ARRAY | 172 | 135 | 143 | 119 | 108 |
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 800 | 458 | 454 | 311 | 273 |
| RLE_DICTIONARY | 223 | 197 | 195 | 186 | 185 |
| BYTE_STREAM_SPLIT | 800 | 707 | 704 | 535 | 495 |
| encoding | UNCOMPRESSED | SNAPPY | LZ4_RAW | ZSTD | GZIP |
|---|---|---|---|---|---|
| PLAIN | 800 | 800 | 803 | 737 | 715 |
| RLE_DICTIONARY | 1,003 | 1,003 | 1,007 | 930 | 902 |
| BYTE_STREAM_SPLIT | 800 | 650 | 616 | 609 | 608 |
What the numbers say:
- Increasing timestamps: DELTA_BINARY_PACKED gets to 329 kB and no codec improves it. The general-purpose codecs on PLAIN do much worse (ZSTD 652 kB); BYTE_STREAM_SPLIT + ZSTD reaches 402 kB. Dictionary is the worst choice, since every value is distinct.
- Random ids: nothing helps, which is the right answer for random data. Dictionary costs 25% extra because Arrow keeps it.
- Low-cardinality strings: dictionary at 38 kB, about 3 bits per value, and already compressed as far as the codecs can take it.
- Sorted URLs: DELTA_BYTE_ARRAY shrinks 4.2 MB to 172 kB before any codec. ZSTD on PLAIN gets almost as far (121 kB) because it finds the shared prefixes itself; Snappy and LZ4_RAW, with smaller windows and no entropy coding, do not.
- Floats with few distinct values (fares): dictionary wins, and BYTE_STREAM_SPLIT hurts.
- Floats that wander (a random walk): BYTE_STREAM_SPLIT is the only thing that helps, and only under a codec: 609 kB with ZSTD against 737 kB for PLAIN with ZSTD.
The rule of thumb: dictionary for repeated values, DELTA_BINARY_PACKED for sorted integers, DELTA_BYTE_ARRAY for sorted strings with shared prefixes, BYTE_STREAM_SPLIT for high-entropy floats under a codec, and ZSTD when CPU allows. Sorting the data (the clustering chapters) is what makes the delta encodings pay.
Q1. parquet-java (and so Spark, by default) writes with WriterVersion PARQUET_1_0. When a STRING column's dictionary falls back, which encoding takes over?
Try it
The playground runs the encoders from src/sim/parquet/encodings.ts in your browser. Pick a preset or type your own comma-separated values; every encoding that supports the type shows its page body size, and the selected one is broken into labeled byte ranges and decoded back.
- With event times, compare PLAIN (320 B) with DELTA_BINARY_PACKED. Click the block header: the min delta is the smallest gap, and the bit widths are what the jitter needs.
- Switch to random ids: DELTA_BINARY_PACKED’s bit widths jump to 41.
- With status codes, pick RLE_DICTIONARY and find the RLE runs of
200and the bit-packed group where 404 and 500 appear. - With urls, compare DELTA_LENGTH_BYTE_ARRAY and DELTA_BYTE_ARRAY, then click the suffixes range.
- With temperature, pick BYTE_STREAM_SPLIT and look at streams 6 and 7: the exponent bytes barely change.
- Type
1, 2, 3, 4, 5with INT64 and DELTA_BINARY_PACKED: the spec’s example 1 with a real block size.
Page body size by encoding · 40 values, PLAIN = 320 B
DELTA_BINARY_PACKED · 96 bytes · decodes back: yes
- 0–9 values header: block size 128, 4 miniblocks, 40 values, first value 1767225600662
- 10–15 values block 0: min delta 207, miniblock bit widths [10, 10, 0, 0]
- 16–55 values block 0, miniblock 0: 32 deltas at 10 bits
- 56–95 values block 0, miniblock 1: 32 deltas at 10 bits
Select a range to see its bytes.
Summary
- PLAIN is values back to back; byte arrays carry a 4-byte length each. It is the dictionary page format and the usual fallback.
- The RLE/bit-packing hybrid stores levels and dictionary ids at a fixed bit width as RLE runs (count, value) and bit-packed runs (multiples of 8 values, LSB first). parquet-java switches to RLE only after 8 repeats.
- Dictionary encoding is a PLAIN dictionary page plus
RLE_DICTIONARYids. parquet-java falls back when the dictionary passes 1 MiB or the first page shows no gain; Arrow only at 1 MiB, and only to PLAIN. - DELTA_BINARY_PACKED stores a first value and, per 128-value block, a min delta and per-miniblock bit widths. DELTA_LENGTH_BYTE_ARRAY delta-codes string lengths; DELTA_BYTE_ARRAY adds prefix sharing.
- BYTE_STREAM_SPLIT changes no sizes and helps codecs on high-entropy numbers; it hurts when values repeat.
- Codecs compress each page body independently; LZ4 (5) is deprecated in favor of LZ4_RAW (7).
Spec links point to apache/parquet-format at 6f87925. Implementation links point to parquet-java 1.17.1, Arrow C++ 26.0.0 and Spark 4.0.1.
Concepts in this chapter
Explained here
Primary sources
Review this chapter
This chapter has 16 quiz questions.