Spark 3.1: fill ORC initial defaults on the row reader - #264
Closed
cbb330 wants to merge 1 commit into
Closed
Conversation
This was referenced Jul 23, 2026
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
July 25, 2026 01:04
a888bee to
4db9002
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
July 25, 2026 01:04
93e4737 to
b22ffd9
Compare
This was referenced Jul 25, 2026
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
July 28, 2026 02:35
4db9002 to
cac8ff0
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
July 28, 2026 02:35
b22ffd9 to
748e269
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
July 28, 2026 03:11
cac8ff0 to
1115244
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
2 times, most recently
from
July 28, 2026 07:13
5de2a95 to
4f928f2
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
July 28, 2026 07:13
1115244 to
0e7b860
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
July 29, 2026 06:08
4f928f2 to
5549db5
Compare
| } | ||
| } | ||
|
|
||
| protected static Object convertConstant(Type type, Object value) { |
There was a problem hiding this comment.
why is this moved out of base data reater?
Comment on lines
+117
to
+118
| // Follow-up: wire initial-default constants into VectorizedSparkOrcReaders. Tables whose | ||
| // in-memory schema declares defaults must remain on the row reader until this path is wired. |
There was a problem hiding this comment.
Is there a PR for the vectorized spark orc readers?
mkuchenbecker
left a comment
There was a problem hiding this comment.
the delineation of spark 3.1 and 3.5 is unclear to me why this is implemented in 3.1?
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
2 times, most recently
from
August 3, 2026 01:38
459d91f to
b6b7d89
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
August 3, 2026 01:58
3fd044f to
5175788
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
August 3, 2026 01:58
b6b7d89 to
77082fc
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
August 3, 2026 02:03
5175788 to
540604c
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
2 times, most recently
from
August 3, 2026 05:47
af3ada9 to
2880ffb
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
August 3, 2026 06:42
540604c to
60115f6
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
August 3, 2026 06:42
2880ffb to
b5e1ffa
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
August 3, 2026 07:10
60115f6 to
d5893e8
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
August 3, 2026 07:10
b5e1ffa to
fd15d74
Compare
cbb330
force-pushed
the
chbush/oh120-orc-default-fill
branch
from
August 3, 2026 07:13
d5893e8 to
ca18b89
Compare
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
2 times, most recently
from
August 3, 2026 07:25
73b8758 to
c7082d1
Compare
Opt the Spark 3.1 row ORC reader into default filling by supplying Spark's constant converter to the id-binding StructReader, so an absent field that declares an initial-default is materialized in Spark's in-memory representation. Move convertConstant out of BaseDataReader into SparkValueConverters in the data package, mirroring Flink's RowDataUtil. The converter is a value conversion utility rather than reader behavior, and the readers that need it live in the data package. This keeps BaseDataReader package-private instead of widening an internal class to public, and leaves the dependency running source -> data. Mirrors the Generic reader; the visitor call site is unchanged. Vectorized reads are not wired yet, so a table whose schema declares defaults must stay on the row reader. Co-authored-by: Cursor <cursoragent@cursor.com>
cbb330
force-pushed
the
chbush/oh120-spark31-default-fill
branch
from
August 3, 2026 21:46
c7082d1 to
51dd54c
Compare
mkuchenbecker
left a comment
There was a problem hiding this comment.
Mostly LGTM, some additional testing and I want to undrestand the default behavior. I know it was moved but it seems like a silent failure (correct me if im wrong on that).
| } | ||
|
|
||
| return new GenericInternalRow(values); | ||
| default: |
There was a problem hiding this comment.
Is the default here correct? Should i.e. i assume this is an error condition.
Comment on lines
+50
to
+58
| private static final Schema WRITE_SCHEMA = | ||
| new Schema( | ||
| required(1, "id", Types.LongType.get()), optional(2, "data", Types.StringType.get())); | ||
|
|
||
| private static final Schema READ_SCHEMA = | ||
| new Schema( | ||
| required(1, "id", Types.LongType.get()), | ||
| optional(2, "data", Types.StringType.get()), | ||
| Types.NestedField.optional("country") |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opts the Spark 3.1 iterative ORC reader into #263's initial-default projection and supplies Spark's constant conversion to the ID-binding
StructReader.RowDataReaderexplicitly callssupportsInitialDefaults().SparkOrcValueReadersconverts missing-field defaults into Spark's in-memory representation.SparkValueConverters, shared with the existing partition-constant path.Scope
Spark 3.1 iterative ORC reads only. The vectorized ORC reader is intentionally deferred; schemas without projected initial defaults continue to vectorize normally.
Other Spark and Flink versions do not opt into #263 and retain their previous projection behavior.
Stack
StructReaderbackportReview this PR's delta against
chbush/oh120-orc-default-fill.Testing Done