Skip to content

[Spark] Advertise SUPPORT_COLUMN_DEFAULT_VALUE catalog capability#6948

Open
TimothyW553 wants to merge 10 commits into
delta-io:masterfrom
TimothyW553:timothy/delta-column-default-capability
Open

[Spark] Advertise SUPPORT_COLUMN_DEFAULT_VALUE catalog capability#6948
TimothyW553 wants to merge 10 commits into
delta-io:masterfrom
TimothyW553:timothy/delta-column-default-capability

Conversation

@TimothyW553
Copy link
Copy Markdown
Collaborator

@TimothyW553 TimothyW553 commented Jun 3, 2026

Which Delta project/connector is this regarding?

  • Spark
  • Standalone
  • Flink
  • Kernel
  • Other (fill in here)

Description

DeltaCatalog now overrides capabilities() to advertise TableCatalogCapability.SUPPORT_COLUMN_DEFAULT_VALUE on top of whatever the delegate catalog already reports.

Spark's analyzer gates column DEFAULT clauses on the catalog capability (ResolveDefaultColumns.validateCatalogForDefaultValue). When a Delta table is created through a non-session V2 catalog (for example Unity Catalog's UCSingleCatalog, which delegates to DeltaCatalog), the missing capability made Spark reject DEFAULT clauses even though Delta already supports the allowColumnDefaults table feature. The session-catalog path is unaffected because Spark's V2SessionCatalog already reports this capability.

How was this patch tested?

New tests in DeltaTableCreationSuite:

  • A unit test that wraps a delegate reporting no capabilities and asserts the
    override adds SUPPORT_COLUMN_DEFAULT_VALUE (this fails without the change).
  • An end-to-end test that creates a Delta table with DEFAULT values across
    string, int, bigint, boolean, double, decimal, and date columns, inserts a
    row omitting those columns, and verifies the defaults are materialized.

build/sbt 'spark/testOnly org.apache.spark.sql.delta.DeltaTableCreationSuite -- -z "Default column values:"' -> 10 tests succeeded, 0 failed.

Does this PR introduce any user-facing changes?

Yes. Column DEFAULT clauses are now accepted on Delta tables created through a
non-session Delta catalog (e.g. Unity Catalog), consistent with the existing
session-catalog behavior.

@TimothyW553 TimothyW553 requested a review from openinx June 3, 2026 22:54
@TimothyW553 TimothyW553 force-pushed the timothy/delta-column-default-capability branch from e657fca to b3eb469 Compare June 3, 2026 23:06
@TimothyW553 TimothyW553 requested review from tdas and yili-db as code owners June 3, 2026 23:06
DeltaCatalog now overrides capabilities() to advertise
TableCatalogCapability.SUPPORT_COLUMN_DEFAULT_VALUE on top of the delegate's
capabilities. UCSingleCatalog forwards its delegate's capabilities, and its
proxy reports none, so DeltaCatalog is what surfaces the capability to Spark.
Without it, Spark's analyzer (validateCatalogForDefaultValue) rejects column
DEFAULT clauses on tables created through Unity Catalog.

Bumps the pinned Unity Catalog SHA used by the UC integration tests to 7ad03012
(unitycatalog#1589) so the end-to-end path is exercised.

Adds an end-to-end test creating a Delta table with DEFAULT values across string,
int, bigint, boolean, double, decimal, date, array, map, and struct columns.
@TimothyW553 TimothyW553 force-pushed the timothy/delta-column-default-capability branch from b3eb469 to ac00116 Compare June 3, 2026 23:20
# `unityCatalogVersion` is obtained by running this script with `--print-version`, so these two
# values are the single source of truth.
UC_PIN_SHA=e1f6e52acc39b925fd6a42180d400ca4e0a3895f
UC_PIN_SHA=7ad030127959453b9010285f4b814dd78b947070
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is temporary and may be reverted if the new SHA on master is higher.

Copy link
Copy Markdown
Collaborator

@openinx openinx left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @TimothyW553 for the work.

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.

2 participants