Skip to content

Comments

[SPARK-51695][SQL][DOCS][FOLLOW-UP] Clarify NULL handling semantics in UNIQUE constraint Javadoc#54357

Open
yyanyy wants to merge 1 commit intoapache:masterfrom
yyanyy:unique_definition_clarify
Open

[SPARK-51695][SQL][DOCS][FOLLOW-UP] Clarify NULL handling semantics in UNIQUE constraint Javadoc#54357
yyanyy wants to merge 1 commit intoapache:masterfrom
yyanyy:unique_definition_clarify

Conversation

@yyanyy
Copy link
Contributor

@yyanyy yyanyy commented Feb 18, 2026

What changes were proposed in this pull request?

Document NULLS DISTINCT behavior: NULL values are treated as distinct from each other, so rows with NULLs in unique columns never conflict. Also note that UNIQUE allows nullable columns (unlike PRIMARY KEY) and that NULLS NOT DISTINCT is not currently supported.

Why are the changes needed?

Better javadoc clarity on UNIQUE constraint expectation.

Does this PR introduce any user-facing change?

No

How was this patch tested?

N/A

Was this patch authored or co-authored using generative AI tooling?

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…n UNIQUE constraint Javadoc

Document NULLS DISTINCT behavior: NULL values are treated as distinct from each other, so rows with NULLs in unique columns never conflict. Also note that UNIQUE allows nullable columns (unlike PRIMARY KEY) and that NULLS NOT DISTINCT is not currently supported.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* if and only if no two rows in a table have the same non-null values in the unique columns.
* Unlike PRIMARY KEY, UNIQUE allows nullable columns.
* <p>
* NULL values are treated as distinct from each other (NULLS DISTINCT semantics). Two rows
Copy link
Member

Choose a reason for hiding this comment

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

We don’t need to define the suggested behavior in Spark itself. The behavior can be left to the connector implementations.

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