Try to reproduce the issue in the GitHub CI pipeline#2395
Draft
xiaoyanxie wants to merge 3 commits into
Draft
Conversation
…ery-serialization
Disable broadcast joins (spark.sql.autoBroadcastJoinThreshold=-1) so the runtime bloom-filter build side becomes a shuffle-backed plan. The ClassCastException only triggers when the injected ScalarSubquery carries a shuffle MapPartitionsRDD lineage; on the sf=1 CI fixture the joins otherwise broadcast and the repro silently passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #2386
Note: This is currently a draft PR.
Rationale for this change
This PR addresses the issue #2386, which reports a subquery serialization failure when the runtime bloom filter optimizer is enabled.
Root Cause Analysis:
Spark's
InjectRuntimeFilteroptimization rewrites eligible join filters into aBloomFilterMightContainexpression whose bloom-filter input is an execution-sideScalarSubquery.Auron converts the bloom-filter expression natively, including its
ExecSubqueryExpressionchild. InNativeConverters.convertExprWithFallback,Auron calls
prepareExecSubquery()to materialize the subquery result, but thenserializes the entire
ScalarSubqueryobject:Although the result has already been materialized, the
ScalarSubquerystill retains its physical plan. Java serialization therefore traverses the plan and its RDD lineage, includingMapPartitionsRDD.dependencies_.The serialized expression is later evaluated by
SparkScalarSubqueryWrapperExpr, which delegates to the JVM expression wrapper. The JVM deserializes it usingObjectInputStreaminNativeConverters.deserializeExpression(). On Scala 2.13, immutable collections are serialized throughscala.collection.generic.DefaultSerializationProxy. During deserialization of the cyclic RDD object graph, a back-reference resolves to the serialization proxy before itsreadResolve()replacement is applied. Java consequently attempts to assign aDefaultSerializationProxyto the RDD.dependencies_:scala.collection.immutable.Seqfield, producing:ClassCastException: cannot assign instance of scala.collection.generic.DefaultSerializationProxy to field org.apache.spark.rdd.RDD.dependencies_.Therefore, the runtime bloom-filter optimization is only the trigger. The underlying defect is that Auron serializes a plan-bearing execution expression after its value has already been computed. This unnecessarily captures the physical plan and RDD lineage.
The issue is specific to the Scala 2.13 path because those immutable collections use serialization proxies. The equivalent Scala 2.12 object graph does not use the same proxy mechanism and therefore happens to deserialize successfully.
This is also distinct from Auron's ordinary unsupported-expression fallback. Those expressions are converted into shallow bound expression trees and do not retain a physical plan or RDD lineage.
Supporting evidence
(TODO)
What changes are included in this PR?
ScalarSubquerybranch within theconvertExprWithFallbackfunction ofNativeConverters.scala:Prevents serializing the entire RDD object graph for ScalarSubquery by exclusively serializing its Scala Literal value.
Are there any user-facing changes?
No
How was this patch tested?
Via integration tests.
Was this patch authored or co-authored using generative AI tooling?
If yes, include:
Generated-by: <tool name and version>ASF guidance: https://www.apache.org/legal/generative-tooling.html