Skip to content

Specify storage inheritance for FILE self-references - #603

Open
alkis wants to merge 10 commits into
apache:masterfrom
alkis:file-self-reference-compression
Open

Specify storage inheritance for FILE self-references#603
alkis wants to merge 10 commits into
apache:masterfrom
alkis:file-self-reference-compression

Conversation

@alkis

@alkis alkis commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Specify storage inheritance semantics for FILE self-references:

  • require an inline field for schemas permitting self-references
  • inherit compression and encryption from the corresponding inline column chunk
  • define each referenced range as an independent compression/encryption block
  • define offset and size over the stored representation
  • require Parquet-mediated resolution of stored bytes
  • define modular-encryption serialization and a page-independent AAD identity
  • leave external references unaffected

Discussion: https://lists.apache.org/thread/zrzc7t9fccg92rx3h4fw3ndw3bdo5xr7

@alkis alkis changed the title Specify compression for FILE self-references Specify storage inheritance for FILE self-references Jul 30, 2026
Comment thread LogicalTypes.md
Comment thread LogicalTypes.md
Comment thread Encryption.md Outdated
Comment thread Encryption.md
| OffsetIndex | yes | yes (7) | yes | yes | no | no |
| BloomFilter Header | yes | yes (8) | yes | yes | no | no |
| BloomFilter Bitset | yes | yes (9) | yes | yes | no | no |
| Self-Reference | yes | yes (10) | yes | yes | no | yes |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Page ordinal is not used here? When only a few pages are required to read, we still need to count number of values of skipped pages in order to decrypt a self-referenced value?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that a derived ordinal is wrong for exactly this reason. I switched the AAD to key on the self-reference offset instead. The offset is a field of the FILE value being read, so the reader has it in hand and never counts values in pages it skips.

Page ordinal would also work for a reader — you know the ordinal of the page you are decoding — but it ties the out-of-band range to page layout, which the rest of this PR deliberately avoids: compression and encryption are properties of the column chunk, not of the page a value happens to land in. Keying on offset keeps the stored representation independent of page boundaries, and the offset already uniquely identifies it within the file.

Key the self-reference AAD on `offset` rather than a derived ordinal, so a
reader can resolve a self-reference without decoding the pages it skips.

State that the encryption buffer of a self-reference must fit the 4-byte
length field, and that larger values must use an external reference.

State that the decompressed size is not stored and how readers obtain it.

State that an encrypted stored representation is bound to a single column
chunk and must not be shared between column chunks.
Comment thread LogicalTypes.md Outdated
Comment thread LogicalTypes.md Outdated
Comment thread LogicalTypes.md Outdated
Comment thread LogicalTypes.md Outdated
Comment thread LogicalTypes.md Outdated
alkis added 3 commits August 6, 2026 18:27
Align the wording with the validation rules, which state the requirement
normatively.

Co-authored-by: Isaac
Describe self-reference storage as being anywhere in the file rather than
in a page, since the referenced bytes are outside the page data.

Drop the forward-looking note about a possible decompressed size field.

State that `offset` and `size` cover the encrypted module for an encrypted
self-reference, as already stated for the unencrypted case.

Describe rather than mandate how the stored bytes are interpreted.

Co-authored-by: Isaac
The previous wording described `size` as the size after compression and
encryption, which omits the length prefix and nonce that the range also
covers. Reference the layout in Encryption.md so the extent is defined in
one place.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants