Skip to content

[VL] feat(iceberg): Add V3 initial value reads - #12537

Merged
zhouyuan merged 1 commit into
apache:mainfrom
infvg:iceberginitvalread
Aug 19, 2026
Merged

[VL] feat(iceberg): Add V3 initial value reads#12537
zhouyuan merged 1 commit into
apache:mainfrom
infvg:iceberginitvalread

Conversation

@infvg

@infvg infvg commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Background

Iceberg V3 supports initial default values for newly added columns, but the velox backend did not previously propagate the required metadata to return those defaults.

Changes

This PR carries Iceberg field IDs and initial-default metadata to Velox.

Impact

Velox can now correctly return configured initial default values instead of NULL when reading older rows from Iceberg V3 tables.

Feature

https://iceberg.apache.org/spec/#default-values

@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@github-actions github-actions Bot added CORE works for Gluten Core VELOX DATA_LAKE labels Jul 16, 2026
@infvg
infvg force-pushed the iceberginitvalread branch from a0f00c0 to 0191abd Compare July 16, 2026 16:53
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@infvg
infvg force-pushed the iceberginitvalread branch from 0191abd to d42bf74 Compare July 16, 2026 17:39
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@infvg
infvg force-pushed the iceberginitvalread branch from d42bf74 to ca3eab5 Compare July 20, 2026 08:50
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@github-actions github-actions Bot removed the CORE works for Gluten Core label Jul 20, 2026
@infvg
infvg force-pushed the iceberginitvalread branch from ca3eab5 to 103561f Compare July 20, 2026 09:10
@github-actions github-actions Bot added the CORE works for Gluten Core label Jul 20, 2026
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@infvg
infvg marked this pull request as ready for review July 20, 2026 13:44
@zhouyuan
zhouyuan requested a lite review from Copilot August 13, 2026 10:36
@zhouyuan

Copy link
Copy Markdown
Member

@infvg could you please help to update on the doc(https://github.com/apache/gluten/blob/main/docs/get-started/VeloxIceberg.md) as well? Please also help to do a rebase as the Velox code has been advanced recently

Copilot AI 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.

Pull request overview

Adds end-to-end plumbing for Iceberg V3 “initial default” values in the Velox backend by propagating Iceberg field IDs + initial-default metadata through Substrait LocalFiles advanced extensions, then consuming that metadata when constructing Velox Iceberg column handles.

Changes:

  • Introduces a backend capability flag and a Velox-specific read extension packer for Iceberg initial defaults.
  • Extends Iceberg LocalFiles nodes to carry and serialize initial-default metadata via Substrait advanced_extension.
  • Adds Velox-side parsing of the new extension and a Velox Iceberg V3 initial-default unit test.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/TransformerApi.scala Adds a default hook for packing Iceberg initial-default metadata into a backend-specific extension.
gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/BackendSettingsApi.scala Adds a backend feature flag for Iceberg initial-default reads (default: false).
gluten-iceberg/src/main/scala/org/apache/iceberg/spark/source/GlutenIcebergSourceUtil.scala Collects Iceberg field IDs + initial defaults from the scan and attaches them to split info.
gluten-iceberg/src/main/scala/org/apache/gluten/execution/IcebergScanTransformer.scala Validates backend support for initial defaults and passes scan context into split generation.
gluten-iceberg/src/main/java/org/apache/gluten/substrait/rel/IcebergLocalFilesNode.java Emits the new Iceberg read extension in LocalFiles.advanced_extension when defaults exist.
gluten-iceberg/src/main/java/org/apache/gluten/substrait/rel/IcebergLocalFilesBuilder.java Wires new constructor parameters (field IDs, initial defaults) into Iceberg LocalFiles node creation.
gluten-iceberg/src-iceberg5/main/java/org/apache/gluten/IcebergDefaultValueUtil.java Introduces Iceberg-version-specific helper for reading initial defaults (stubbed to null here).
gluten-iceberg/src-iceberg3/main/java/org/apache/gluten/IcebergDefaultValueUtil.java Introduces Iceberg-version-specific helper for reading initial defaults (stubbed to null here).
gluten-iceberg/src-iceberg10/main/java/org/apache/gluten/IcebergDefaultValueUtil.java Implements initial default extraction via field.initialDefault().
cpp/velox/substrait/SubstraitToVeloxPlan.cc Uses parsed Iceberg default metadata to select IcebergColumnHandle when needed.
cpp/velox/compute/VeloxPlanConverter.cc Passes LocalFiles.advanced_extension into Iceberg split parsing.
cpp/velox/compute/iceberg/IcebergPlanConverter.h Adds column metadata (fieldId + initialDefault) to Iceberg split info and updates parsing signature.
cpp/velox/compute/iceberg/IcebergPlanConverter.cc Unpacks and stores the new Iceberg read extension from advanced_extension.
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxTransformerApi.scala Implements packing of IcebergReadExtension protobuf into a Substrait Any.
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxBackend.scala Enables Iceberg initial-default reads for Velox backend settings.
backends-velox/src/main/resources/org/apache/gluten/proto/IcebergReadExtension.proto Defines the protobuf payload carried in LocalFiles.advanced_extension.
backends-velox/src-iceberg/test/scala/org/apache/gluten/execution/VeloxIcebergSuite.scala Adds a test validating Iceberg V3 initial default values are returned under Velox.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 216 to 218
case p: SparkDataSourceRDDPartition =>
GlutenIcebergSourceUtil.genSplitInfo(p, getPartitionSchema, metadataColumnNames)
GlutenIcebergSourceUtil.genSplitInfo(p, scan, getPartitionSchema, metadataColumnNames)
case _ => throw new GlutenNotSupportException()

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.

fixed

Comment on lines +108 to 111
metadataColumns,
getFieldIds(sparkScan),
getInitialDefaults(sparkScan)
)

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.

fixed

@infvg
infvg force-pushed the iceberginitvalread branch from 103561f to bbb37b0 Compare August 13, 2026 13:30
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@infvg
infvg force-pushed the iceberginitvalread branch from bbb37b0 to 9e167a1 Compare August 13, 2026 18:48
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@zhouyuan
zhouyuan merged commit af7b9dd into apache:main Aug 19, 2026
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core DATA_LAKE VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants