Skip to content

GH-634: FILE: Readers must resolve the value from inline when inline and a locator are both set - #635

Draft
stefan-grafberger wants to merge 6 commits into
apache:masterfrom
stefan-grafberger:file-inline-provenance
Draft

stefan-grafberger wants to merge 6 commits into
apache:masterfrom
stefan-grafberger:file-inline-provenance

Conversation

@stefan-grafberger

@stefan-grafberger stefan-grafberger commented Nov 3, 2026 •

Copy link
Copy Markdown

Rationale for this change

#603 allows a reader to resolve a value that sets both inline and a locator from either, so engines can return different bytes for the same value once the referenced data changes. The current text also expects producers to write the same bytes in both without limiting this to the time the value is written. This can be read as requiring them to keep the referenced data unchanged, which writers can't guarantee when it is outside their control, e.g., in a storage bucket managed by users rather than by the engine.

What changes are included in this PR?

  • Specifies that if inline and a locator are both set, readers must resolve the value from inline, and the locator fields record where those bytes came from. This restores the reader rule from the original FILE PR Introduces a new LogicalType: FILE #585 ("If inline is set, it supplies the bytes for readers"), which Remove FILE self-references #603 changed to "a reader may resolve the value from either", while keeping Remove FILE self-references #603's clarification that both may be set.
  • Requires inline to be a copy of the referenced bytes at the time the value is written, and states that producers are not required to ensure that the referenced data stays unchanged or available afterwards.

No existing value becomes invalid, and for values that set both inline and a locator, readers may only return inline.

This is an alternative to #644, which instead keeps the reader's choice and makes the result undefined if the referenced data changes. See the discussion on the mailing list: https://lists.apache.org/thread/t5n2ch4p4yx7czf7gpl909ypmdgzm3nh

Do these changes have PoC implementations?

Hardwood (hardwood#1494) already reads inline first when it is set.

Closes #634

Comment thread LogicalTypes.md Resolved
Comment thread LogicalTypes.md Resolved
Comment thread LogicalTypes.md Resolved
Comment thread LogicalTypes.md Resolved
@stefan-grafberger stefan-grafberger changed the title GH-634: FILE: Locator fields are provenance only when inline is set GH-634: FILE: Readers resolve the value from inline when inline and a locator are both set Nov 4, 2026
Comment thread LogicalTypes.md Resolved

@rok rok left a comment

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.

One optional nit from me. Otherwise looks good. We should get more eyes on this though!

stefan-grafberger and others added 2 commits November 4, 2026 13:50
…erenced by the locator (for ETAG, the whole file at uri), so it's also clear for ranges with offset and size
Co-authored-by: Rok Mihevc <rok@mihevc.org>
@wgtmac

wgtmac commented Nov 4, 2026

Copy link
Copy Markdown
Member

cc @alkis @brkyvz

@rok
rok requested a review from danielcweeks November 4, 2026 14:37

@brkyvz brkyvz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know... My hope was that inline would serve as a cache for small data for sequential read use cases. I was still hoping that we could still send the file reference to a remote server for example where it can read files directly instead of having to send the bytes over the wire. This change would force us to send the bytes over the wire.
That's why we kept the definition somewhat open.

An orthogonal pain point that I was wondering if we could modify is relax the usage of "size" when there's no offset. Because on the one hand, it's nice to have it as metadata, but it can cause issues when a file gets mutated - it has the same problem with inline in that sense.

@rok

rok commented Nov 5, 2026

Copy link
Copy Markdown
Member

I don't know... My hope was that inline would serve as a cache for small data for sequential read use cases. I was still hoping that we could still send the file reference to a remote server for example where it can read files directly instead of having to send the bytes over the wire. This change would force us to send the bytes over the wire. That's why we kept the definition somewhat open.

Sending uris over network instead ob inline bytes makes sense. As mutability of remote files is out of our scope we can't really prescribe anything about writing. But we do have etag and we can say that a reader can read either inline or uri, but if it chooses uri it should verify it with etag.

Comment thread LogicalTypes.md Resolved
Comment thread LogicalTypes.md Resolved
Comment thread LogicalTypes.md Resolved

@danielcweeks danielcweeks left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Many of the changes to this are not forward-compatible. We need to make sure that we do not change the requirements in incompatible ways.

Comment thread LogicalTypes.md
Producers are expected to write the same bytes in both, but a reader is not required
to check this and may return the bytes of either. Producers may treat `inline` and the
locator fields as mutually exclusive.
* If `inline` and a locator are both set, readers must resolve the value from `inline`.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If people prefer, this could also be a "should" instead of a "must", to leave room for readers that already resolve the locator, as the current spec allows:

Suggested change
* If `inline` and a locator are both set, readers must resolve the value from `inline`.
* If `inline` and a locator are both set, readers should resolve the value from `inline`.

The inline field description would then change accordingly ("Readers should resolve the value from inline").

@stefan-grafberger stefan-grafberger changed the title GH-634: FILE: Readers resolve the value from inline when inline and a locator are both set GH-634: FILE: Readers must resolve the value from inline when inline and a locator are both set Nov 20, 2026
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.

FILE: Specify which bytes a value resolves to when inline and uri are both set

6 participants