shrirangmhalgi opened a new pull request, #56578: URL: https://github.com/apache/spark/pull/56578
### What changes were proposed in this pull request? After `FlowAnalysis.analyze` resolves the plan via `transformWithSubqueries`, scan for `LogicalRelation` / `DataSourceV2Relation` / `HiveTableRelation` nodes whose table name matches a known pipeline input. Record these as `externalInputs` so the DAG scheduler correctly orders execution. ### Why are the changes needed? `FlowAnalysis.analyze` only intercepts `UnresolvedRelation` nodes when building the pipeline dependency graph. If a flow's plan contains a pre-resolved table reference (e.g., from `spark.table()` in classic mode or a plan that was analyzed before reaching `FlowAnalysis`), the dependency is invisible to the scheduler. This causes downstream flows to execute before their upstream dependencies, resulting in either `TABLE_OR_VIEW_NOT_FOUND` errors or stale data reads. ### Does this PR introduce _any_ user-facing change? Yes. Pipeline flows that reference upstream datasets via `spark.table()` now correctly infer the dependency, ensuring correct execution order. ### How was this patch tested? New SparkTableLineageSuite with two tests: - Resolved table reference (LogicalRelation) detected as pipeline input (was invisible before fix) - Control test confirming readFlowFunc (the UnresolvedRelation path) continues to work - Full pipeline test suite passes (378 tests, 0 failures). ### Was this patch authored or co-authored using generative AI tooling? Yes. Authored using Claude Opus 4.6. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
