ORC/Spark: forward-port default-value reads via idToConstant (LI #76) - #267
Conversation
cbb330
left a comment
There was a problem hiding this comment.
Inline annotations for the reviewer guide: forward-ported as-is vs forward-ported with changes. See the updated tables in the PR description for links back to each comment.
3302e57 to
8c8d99b
Compare
|
@mkuchenbecker carrying over your notes from #264 (and the Generic fill site on #263). Those PRs are closed; this is where the answers live. Vectorized: no fill PR. Defaulted projections are forced onto the row reader ( Spark 3.1 vs 3.5: this stack is
Silent failure / is null an error: if we cannot prove the column was never written, we do not fill — we keep null (status quo). We do not throw and we do not invent a default. That is intentional. The case you wanted to avoid (silently overlaying a default on real data) is handled by refusing to omit, not by failing the read. All data types: current coverage is int/string and a nested scalar ( Generic |
Restore the production Spark ORC initial-default path from f200623: omit absent defaulted fields from the ORC projection and inject them into idToConstant so row and vectorized readers fill via existing constant readers. Adapted to the upstream initial-default API and gated behind supportsInitialDefaults so shared ORCSchemaUtil does not break Generic.
Vectorized ORC default-fill is out of scope. SparkBatchScan disables columnar ORC when the projection includes an initial-default, and the batched reader no longer opts into omission.
Keep the why (opt-in omit, row-only fill, nested defaults not API-legal). Drop stack TODOs, commit SHAs, and forward-port narration.
526e934 to
95fbc27
Compare
mkuchenbecker
left a comment
There was a problem hiding this comment.
why is the vectorized dir needed?
Vectorized fill is out of scope; SparkBatchScan already keeps defaulted projections on the row reader. Restore the batched visitor and constant vectors to the pre-#76 path.
@mkuchenbecker good catch, i removed them. they are dead code in this PR since I disabled vectorized. these came forward from the original work from RZ from the forward port. but we aren't using it any time soon |
abhisheknath2011
left a comment
There was a problem hiding this comment.
Approving to unblock the merge. @mkuchenbecker already approved.
Summary
Forward-port of the Spark ORC default-value read path from LI #76 onto
openhouse-1.2.0, adapted toinitial-defaultand stacked on id-bound ORC structs (#265).Absent defaulted fields are omitted from the per-file ORC projection and injected into
idToConstant. The Spark row reader fills them. Omit is opt-in (supportsInitialDefaults) becauseORCSchemaUtilis shared with Generic.Vectorized ORC default-fill is out of scope.
SparkBatchScandisables columnar ORC when the projection includes aninitial-default. The vectorized-dir leftovers from #76 were dropped from this PR.Mechanism (same as #76):
idToConstantConstantReadermaterializes themInline notes mark each site as as-is or changed vs #76 (review).
Stack #270: this PR → #268 → #269.
Reviewer guide
As-is
visitRecordOrcSchemaWithTypeVisitorcontainsInOrderSparkOrcReaderconvertConstantSTRUCT/LIST/MAPconvertConstantChanged
initialDefault(); omit gatedORCSchemaUtilis shared with GenericinitialDefault() != nullstruct(record, ...)castDefaultrejects non-null nested defaults (apache/iceberg#14611). Nested scalar defaults (e.g.loc.country) are coveredFollow-ups
castDefault+ nested-typed defaultsReplaces #263/#264 for the Spark fill path.
Testing Done
testOrcScalarDefaultValues— passtestOrcNestedScalarDefaultValues— passTestSparkBatchScanInitialDefaults— pass