Parquet Nested Columns: Definition and Repetition Levels
2026-11-10

Parquet Nested Columns: Definition and Repetition Levels

Parquet Nested Columns preserve more than the numeric values that appear in a leaf field. In a robotics log, one inspection record can contain several samples, and each sample can contain an optional reading. A column containing only the present readings would lose information about which samples and records those readings came from. The format uses two kinds of level to preserve those relationships.

A leaf value has a path through the record schema

Imagine a root inspection record with a repeated group called sample. Each occurrence of that group has an optional integer field called temperature. The path for the leaf column in this example is sample.temperature. A record may contain several sample groups, one group, or none. When a group exists, its temperature can still be missing.

Suppose record A has two sample groups. The first contains a value of 22 and the second has no temperature. Record B contains no sample groups. Record C has one sample group with value 19. The physical integer values for the leaf are just 22 and 19. That pair does not preserve the empty middle record or the missing reading inside the first record.

Three example rows show two sample groups in A, no groups in B, and one group in C, with a missing temperature in the second group of A.
Only 22 and 19 are stored integer values in the illustrated leaf. Source: Zhilianhai editorial desk, original AI-assisted concept; no real product, event or measured data.

Definition levels show how much of the path exists

The Parquet nested encoding documentation points to the definition-level scheme in the original Dremel paper. The paper explains that a level counts the fields along the leaf path that could be absent, whether because they are optional or repeated, and are actually defined. The schema provides the maximum level. In this example there are two such positions, the sample group and the temperature field.

Definition level 2 means both the group and the temperature exist, so a value accompanies the entry. Level 1 means the sample exists but the optional temperature does not. Level 0 represents the path when no sample group occurs. The two entries without integers therefore describe different record structures. Neither entry supplies a numeric zero as a temperature.

Repetition levels tell where the next occurrence belongs

A repetition level is interpreted against the repeated fields on the path. The Dremel description uses level 0 for the beginning of a new root record. With one repeated ancestor in this example, level 1 marks a subsequent occurrence of that ancestor in the same root record. This keeps a second sample group from being read as the first group of a new inspection record.

The first entry for A has repetition level 0 and definition level 2. The second entry for A has repetition level 1 and definition level 1. B contributes a structural entry at repetition 0 and definition 0. C starts another record at repetition 0 and definition 2. The two level streams thus describe four structural positions while the leaf supplies only two integer values.

A table shows A1 R0 D2 value22, A2 R1 D1 absent, B R0 D0 absent, C1 R0 D2 value19.
Record boundaries and missing elements remain distinguishable. Source: Zhilianhai editorial desk, original AI-assisted concept; no real product, event or measured data.

Interpret the levels together with the schema

When a reader encounters the second position of A, the repetition level keeps it inside A and the definition level explains that the sample exists. The next position starts B and says no sample exists. Without the schema, the same level numbers could refer to different ancestors or a different maximum, so a decoded field path gives the levels their meaning.

For instance, adding a second repeated group above sample would give the temperature path two repeated ancestors. A subsequent occurrence could then restart at either repeated layer. Likewise, making a parent optional could add a definition position. The simple example uses one repeated group deliberately. A list with an optional container can introduce other distinctions and needs to be interpreted using its own schema.

A numeric count and a structural count answer different questions

A diagnostic view might display blank entries in both cases. The levels still differentiate the two blanks, because the repeated ancestor is defined in A’s second position and absent for B.

A data review can distinguish the number of inspection records, the number of sample occurrences and the number of temperatures present. The example has three records, three sample occurrences and two temperatures. The repeated sample entry with an absent reading affects the sample count even though it supplies no integer. The empty record contributes to the record count without contributing a sample occurrence.

Keeping those counts separate helps when one report describes only the temperature values and another describes the underlying capture process. Both views may be correct while reporting different totals. The levels explain which features of the original nesting remain represented in a leaf column.

The Apache Parquet nested encoding reference identifies the two level streams and their schema-derived limits. The original Dremel paper explains how both levels are assigned and used to preserve structure. See the robotics data reference and technical article directory.

18028484626 CONTACT US

公司:智联海(惠州)科技有限公司

地址:惠州仲恺高新区陈江街道白云山工业大道 5 号六楼 601

Q Q:18028484626

Copyright © 2002-2026

粤xxx

咨询 在线留言 电话:18028484626
微信 微信扫码添加我