Repository navigation
[KYUUBI #6314][SPARK] Preserve lineage for temporary view inserts - #7791
wayne-x-wang wants to merge 2 commits into
Conversation
|
Could a maintainer please re-run the failed jobs? All 77 lineage tests passed. The two failures are in EngineRefWithZookeeperSuite and the ZooKeeper 3.7 integration test, outside this patch’s changes. |
|
Locally, the ZooKeeper 3.7 test passed three consecutive runs, while the EngineRef timeout test reproduced the failure. The EngineRef test passes a null engineManager, causing an NPE during timeout cleanup, and relies on unreliable Spark startup timing assumptions. These failures are unrelated to this PR’s lineage changes; all 77 lineage tests, including the new JDBC regression cases, passed in CI. |
pan3793
left a comment
There was a problem hiding this comment.
The fix is correct for the JDBC temp-view path, but the same failure class remains in the sibling file-source branch, so the change is not yet complete.
1. Blocking - same MatchError still live in InsertIntoHadoopFsRelationCommand (SparkSQLLineageParseHelper.scala:281). A temp view over a file source is a LogicalRelation with catalogTable = None, so INSERT OVERWRITE TABLE <json/parquet temp view> throws scala.MatchError: (key#0,{key#0}) at line 274. Confirmed at 9b6c365. Fix both branches the same way: carry Option[String] and map it instead of getOrElse("") plus a guard, and add a file-source temp view regression (the suite's SimpleInsertSource reproduces it without Derby).
2. SparkSQLLineageParserHelperSuite.scala:385-388 asserts Derby shutdown SQLState inside finally; a best-effort Try(...) avoids masking the real failure.
3. Drop the two info() plan dumps at lines 354-355; they run in both suites.
4. assert(outputTables == List()) also held before the change; the parse equality is what pins it.
Verified: the new test fails with MatchError when the fix is reverted, 77/77 lineage tests pass at head, plan node/fields unchanged on Spark 3.5.8 and 4.2.0.

Why are the changes needed?
Inserts into JDBC and file-source temporary views can lack target
catalogTablemetadata. The guarded column-lineage mappings throwMatchErroreven though the writes succeed.Keep the optional target table name in both
InsertIntoDataSourceCommandandInsertIntoHadoopFsRelationCommand. When metadata is absent, preserve query column names and source lineage without inventing a destination table.outputTablesremains empty. Catalog-backed inserts retain their existing behavior.Fixes #6314.
How was this patch tested?
The embedded Derby regression creates a JDBC temporary view, executes an insert, and reads the stored row through JDBC. Added JSON and Parquet temporary-view regressions that execute
INSERT OVERWRITE, read the stored rows, and verifyInsertIntoHadoopFsRelationCommandwith absentcatalogTable. All three cases assert the fullLineagethrough bothparseandtransformToLineage, including source tables, column mappings, and empty output tables. Both inherited parser suites run these tests. Existing catalog-backed insert tests check the metadata-present behavior.Before the file-source fix, the new JSON and Parquet tests both failed with
MatchErrorwhile the JDBC test passed. The original JDBC regression was also verified to fail without its fix.Spark 3.5.8 / Scala 2.12: all 81 lineage tests passed, along with Spotless and Scalastyle.
Spark 4.2.0 / Scala 2.13: all 81 lineage tests passed.
dev/reformatandgit diff --checkpassed; formatting preserved the tested patch unchanged.The historical Kyuubi 1.8.0 / Spark 3.2.3 combination and MySQL were not tested.
Was this patch assisted by generative AI tooling?
Assisted-by: Codex (GPT-6)