This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new b8168834c8b1 [SPARK-60824][SQL][FOLLOWUP] Fix compilation error by 
updating `AddCheckConstraint` patterns in `Analyzer`
b8168834c8b1 is described below

commit b8168834c8b18a4f16f3267ecd48f3afaaaf6937
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Tue Nov 3 15:28:22 2026 -0800

    [SPARK-60824][SQL][FOLLOWUP] Fix compilation error by updating 
`AddCheckConstraint` patterns in `Analyzer`
    
    ### What changes were proposed in this pull request?
    
    This PR fixes the compilation error on `master` by adding the missing 
`analyzedQuery` argument to the two `AddCheckConstraint` patterns in 
`Analyzer`. #60042 (SPARK-60824) added `analyzedQuery` as a third field of 
`AddCheckConstraint`.
    
    ```scala
    -      case a  AddCheckConstraint(Filter(_, SubqueryAlias(_, v: View)), _) 
=>
    +      case a  AddCheckConstraint(Filter(_, SubqueryAlias(_, v: View)), _, 
_) =>
    ...
    -      case a  AddCheckConstraint(Filter(_, m: MetricViewPlaceholder), _) =>
    +      case a  AddCheckConstraint(Filter(_, m: MetricViewPlaceholder), _, 
_) =>
    ```
    
    ### Why are the changes needed?
    
    `master` fails to compile. #60040 (SPARK-60822) added these two patterns 
with two arguments. #60042 (SPARK-60824) then added the third field 
`analyzedQuery` to `AddCheckConstraint`, and its head did not include #60040, 
so these patterns were left unchanged. Each PR compiled on its own, but 
`master` with both of them does not.
    
    - https://github.com/apache/spark/actions/runs/41735537666
    
    ```
    [error] 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:1360:34:
 wrong number of arguments for pattern 
org.apache.spark.sql.catalyst.plans.logical.AddCheckConstraint(child: 
org.apache.spark.sql.catalyst.plans.logical.LogicalPlan, checkConstraint: 
org.apache.spark.sql.catalyst.expressions.CheckConstraint, analyzedQuery: 
Option[org.apache.spark.sql.catalyst.plans.logical.LogicalPlan])
    [error]       case a  AddCheckConstraint(Filter(_, SubqueryAlias(_, v: 
View)), _) =>
    [error]                                  ^
    [error] 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:1363:34:
 wrong number of arguments for pattern 
org.apache.spark.sql.catalyst.plans.logical.AddCheckConstraint(child: 
org.apache.spark.sql.catalyst.plans.logical.LogicalPlan, checkConstraint: 
org.apache.spark.sql.catalyst.expressions.CheckConstraint, analyzedQuery: 
Option[org.apache.spark.sql.catalyst.plans.logical.LogicalPlan])
    [error]       case a  AddCheckConstraint(Filter(_, m: 
MetricViewPlaceholder), _) =>
    [error]                                  ^
    [error] 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:66:48:
 Unused import
    [error] import org.apache.spark.sql.metricview.logical.MetricViewPlaceholder
    [error]                                                ^
    [error] three errors found
    [error] (catalyst / Compile / compileIncremental) Compilation failed
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. This only fixes the compilation of the unreleased changes on `master`.
    
    ### How was this patch tested?
    
    Pass the CIs. In addition, I compiled all main and test sources with the 
same profiles as the CI build job and ran the related test suite manually.
    
    ```
    $ build/sbt -Phadoop-3 -Pyarn -Pspark-ganglia-lgpl -Phadoop-cloud -Phive \
      -Pkubernetes -Pjvm-profiler -Pkinesis-asl -Pcredential-aws 
-Phive-thriftserver \
      -Pdocker-integration-tests -Pkubernetes-integration-tests -Pvolcano 
-Poidc-e2e \
      Test/compile
    ...
    [success] Total time: 173 s (0:02:53.0), completed Nov 3, 2026, 3:15:05 PM
    ```
    
    ```
    $ build/sbt 'sql/testOnly 
org.apache.spark.sql.execution.command.v2.CheckConstraintSuite'
    ...
    [info] - Check CONSTRAINT using V2 catalog V2 command: SPARK-60824: Alter 
table add check constraint that always holds (27 milliseconds)
    [info] - Check CONSTRAINT using V2 catalog V2 command: SPARK-60822: Check 
constraint cannot be added to a view (71 milliseconds)
    [info] - Check CONSTRAINT using V2 catalog V2 command: SPARK-60822: Check 
constraint cannot be added to a metric view (77 milliseconds)
    ...
    [info] Tests: succeeded 66, failed 0, canceled 0, ignored 0, pending 0
    [info] All tests passed.
    ```
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 5.5
    
    Closes #60070 from dongjoon-hyun/d/master-compile-error-check-90ddc3.
    
    Authored-by: Dongjoon Hyun <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
index fd45877a718d..deee0e8b18e6 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
@@ -1357,10 +1357,10 @@ class Analyzer(
 
       // The child of `AddCheckConstraint` reads its target to validate the 
existing data, so the
       // target is an `UnresolvedRelation` that can resolve to a view, unlike 
`UnresolvedTable`.
-      case a @ AddCheckConstraint(Filter(_, SubqueryAlias(_, v: View)), _) =>
+      case a @ AddCheckConstraint(Filter(_, SubqueryAlias(_, v: View)), _, _) 
=>
         throw QueryCompilationErrors.expectTableNotViewError(
           v.desc.fullIdent, "ALTER TABLE ... ADD CONSTRAINT", 
suggestAlternative = false, a)
-      case a @ AddCheckConstraint(Filter(_, m: MetricViewPlaceholder), _) =>
+      case a @ AddCheckConstraint(Filter(_, m: MetricViewPlaceholder), _, _) =>
         throw QueryCompilationErrors.expectTableNotViewError(
           m.metadata.fullIdent, "ALTER TABLE ... ADD CONSTRAINT", 
suggestAlternative = false, a)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to