[CORE] Fix UnsupportedOperationException in input_file_name() with broadcast join build-side LocalRelation#12272
Merged
taiyang-li merged 1 commit intoJun 12, 2026
Conversation
|
Run Gluten Clickhouse CI on x86 |
|
Run Gluten Clickhouse CI on x86 |
82dcdc4 to
a9fc169
Compare
|
Run Gluten Clickhouse CI on x86 |
WangGuangxin
approved these changes
Jun 12, 2026
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.
Problem
The newly added ut failed:
Root cause
PushDownInputFileExpression.PreOffloadoriginally injectsProject [..., input_file_name() AS attr#N]above everyLeafExecNode(with a fallback tag).When the broadcast build side is a non-file leaf (e.g.
LocalTableScanExecfrom a constant subquery), the rule still wraps that leaf with a fallbackProjectExec. This forces vanilla Spark to wrap the subtree inWholeStageCodegenfor the broadcast side. Down the road,VeloxBroadcastNestedLoopJoinExecTransformer.columnarInputRDDs→InputIteratorTransformer.doExecuteBroadcast→RowToVeloxColumnarExec.doExecuteBroadcast→child.executeBroadcastends up callingWholeStageCodegenExec.doExecuteBroadcast, which is not implemented, henceUnsupportedOperationException.In short: the rule was injecting
input_file_name()on leaves that cannot produce a real file name in the first place (they have noInputFileBlockHoldercontext), and the resulting fallback Project changes the operator shape on the broadcast side so the broadcast pipeline can no longer be executed.Fix
Limit the rewrite to leaves that can actually populate
InputFileBlockHolder:FileSourceScanExecBatchScanExecHiveTableScanExecTransformer.isHiveTableScan)BatchScanExecTransformerBase(already special-cased in community for Iceberg etc.)In addition, the
ProjectExecmatch inPreOffloadnow requires that the subtree actually contains at least one such file-aware source via the newhasInputFileRelatedSourcehelper. Other leaves (LocalTableScanExec,RangeExec,RDDScanExec, ...) are left untouched, so the broadcast build side keeps its original shape and thedoExecuteBroadcastpath no longer terminates atWholeStageCodegen.As a nice side effect, this also avoids producing a fake empty
input_file_nameattribute on non-file leaves, which previously could collide with a real file scan's ExprId on the other side of the join and silently return an empty file name.Test
Added
input_file_name() with BHJ build-side LocalRelation must return real pathinbackends-veloxScalarFunctionsValidateSuite, which reproduces the failing scenario (parquet table broadcast-joined with a literal subquery, projectinginput_file_name()) and asserts:UnsupportedOperationException.compareResultsAgainstVanillaSpark.fnameis non-empty and contains the real parquet path.The existing
test("input_file_name")(file/Hive scan paths) is unchanged because those scans remain in the whitelist.