← Back to Pull requests

[SPARK-56652][SQL] Always emit RELY/NORELY in DESCRIBE EXTENDED constraint output #55590

Closed
unknown closed this pull request without merging on Apr 29, 2026 20:16 UTC
View on GitHub
unknown unknown commented on Apr 28, 2026 22:16 UTC
Author

What changes were proposed in this pull request?

BaseConstraint.toDescription() now always emits RELY|NORELY, matching toDDL() used by SHOW CREATE TABLE. Previously, toDescription() skipped the NORELY token when rely=false, so the same constraint rendered differently across the two surfaces.

After this change, the invariant holds:
toDDL is "CONSTRAINT " + name + " " + toDescription.

Why are the changes needed?

After SPARK-52141 (DESCRIBE EXTENDED) and SPARK-52142 (SHOW CREATE TABLE) landed, the two surfaces render the same constraint asymmetrically:

| State | DESCRIBE EXTENDED (before) | SHOW CREATE TABLE |
|--------------|-----------------------------------|-------------------------------------|
| PK default | PRIMARY KEY (a) NOT ENFORCED | PRIMARY KEY (a) NOT ENFORCED NORELY |
| CHECK default| CHECK (...) ENFORCED | CHECK (...) ENFORCED NORELY |

The original review on PR #51577 considered skipping both NOT ENFORCED and NORELY when default, but only NORELY was skipped because ENFORCED's default is per-subclass and not visible to BaseConstraint. The result is a confusing experience: SHOW CREATE TABLE reports the rely state explicitly while DESCRIBE EXTENDED hides it for the default value.

Does this PR introduce any user-facing change?

Slight output change in DESCRIBE EXTENDED command output. DESCRIBE EXTENDED now emits NORELY for constraints whose rely value is the default. PRIMARY KEY / UNIQUE / FOREIGN KEY / CHECK constraints all show the full ENFORCED|NOT ENFORCED RELY|NORELY suffix, matching SHOW CREATE TABLE.

How was this patch tested?

Updated golden strings in the v2 DescribeTableSuite "desc table constraints" test. Ran:

build/sbt 'sql/testOnly \
org.apache.spark.sql.execution.command.v2.DescribeTableSuite \
org.apache.spark.sql.execution.command.v2.ShowCreateTableSuite'

41 tests pass.

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

Claude Opus 4.7

Diff: 260 lines (+195 / -65) across 3 files Reviewer: yyanyy Review duration: 1319m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 260 lines diff across 3 files
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.333
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #55590"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.2% (MEDIUM) · Higher = larger blast radius
39.2%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.5% · Safe to merge
15.5%
Repository