Skip to content

[KYUUBI #7746][FOLLOWUP] Fix nondeterministic CTE test assertion on Spark 3.3 - #7758

Open
pan3793 wants to merge 1 commit into
apache:branch-1.12from
pan3793:kyuubi-7746-followup-spark33-cte-test
Open

pan3793 wants to merge 1 commit into
apache:branch-1.12from
pan3793:kyuubi-7746-followup-spark33-cte-test

Conversation

@pan3793

@pan3793 pan3793 commented Sep 21, 2026

Copy link
Copy Markdown
Member

Why are the changes needed?

df5aa6c (KYUUBI #7746) added a test asserting that the optimized plan for a not-inlined nondeterministic CTE contains a RepartitionByExpression node. This assertion fails on Spark 3.3: SPARK-40105 (3.4.0) changed ReplaceCTERefWithRepartition to wrap not-inlined CTE references with RepartitionByExpression; before that it wraps them with a plain Repartition. So on Spark 3.3 the optimized plan contains Repartition, not RepartitionByExpression, and the assertion always fails.

How was this patch tested?

Updated the assertion to expect Repartition on Spark 3.3 and RepartitionByExpression on 3.4+, following the existing isSparkV34OrGreater pattern used elsewhere in this suite.

Ran HiveCatalogRangerSparkExtensionSuite under both profiles:

build/mvn -Pspark-3.3 test -pl extensions/spark/kyuubi-spark-authz -am -Dtest=none -DwildcardSuites=org.apache.kyuubi.plugin.spark.authz.ranger.HiveCatalogRangerSparkExtensionSuite
build/mvn test -pl extensions/spark/kyuubi-spark-authz -am -Dtest=none -DwildcardSuites=org.apache.kyuubi.plugin.spark.authz.ranger.HiveCatalogRangerSparkExtensionSuite

Both pass, including the two tests added by KYUUBI #7746.

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

Assisted-by: Claude Sonnet 5

…n on Spark 3.3

df5aa6c (KYUUBI apache#7746) asserts the optimized plan for a not-inlined
CTE contains RepartitionByExpression. SPARK-40105 (3.4.0) changed
ReplaceCTERefWithRepartition to emit RepartitionByExpression instead
of a plain Repartition, so on Spark 3.3 the assertion always fails.

Assert Repartition on Spark 3.3 and RepartitionByExpression on 3.4+.

Assisted-by: Claude Sonnet 5
@pan3793

pan3793 commented Sep 21, 2026

Copy link
Copy Markdown
Member Author

cc @j1wonpark

@j1wonpark j1wonpark 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.

Thanks for the follow-up, and sorry for the Spark 3.3 breakage. Verified locally on 3.3.4: both tests pass, and removing the deterministic override in PermanentViewMarker makes them fail again. LGTM (non-binding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants