-
Notifications
You must be signed in to change notification settings - Fork 1k
[KYUUBI #6912][LINEAGE] Properly handle empty attribute set on mergeRelationColumnLineage #6911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
xglv1985
wants to merge
7
commits into
apache:master
from
xglv1985:fix_spark_lineage_runtime_exception
Closed
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
fbb4df8
fix a runtime exception when generate column lineage tuple
9018790
fix a runtime exception when generate column lineage tuple--unit test
fea6bbc
fix a runtime exception when generate column lineage tuple--remove ta…
52bc028
fix a runtime exception when generate column lineage tuple--spotless …
59b350b
fix a runtime exception when generate column lineage tuple--more read…
4e89b95
Update extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apach…
pan3793 13a7107
Update extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apach…
pan3793 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -59,10 +59,16 @@ class SparkSQLLineageParserHelperSuite extends KyuubiFunSuite | |||||||||||||||||||||||||||||||||||||||||
| " partitioned by(pid)") | ||||||||||||||||||||||||||||||||||||||||||
| spark.sql("create table if not exists test_db0.test_table1" + | ||||||||||||||||||||||||||||||||||||||||||
| " (key int, value string) using parquet") | ||||||||||||||||||||||||||||||||||||||||||
| spark.sql("create table test_db.test_table_from_dir" + | ||||||||||||||||||||||||||||||||||||||||||
| " (`a0` string, `b0` string) using parquet") | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| override def afterAll(): Unit = { | ||||||||||||||||||||||||||||||||||||||||||
| Seq("test_db0.test_table0", "test_db0.test_table1", "test_db0.test_table_part0").foreach { t => | ||||||||||||||||||||||||||||||||||||||||||
| Seq( | ||||||||||||||||||||||||||||||||||||||||||
| "test_db0.test_table0", | ||||||||||||||||||||||||||||||||||||||||||
| "test_db0.test_table1", | ||||||||||||||||||||||||||||||||||||||||||
| "test_db0.test_table_part0", | ||||||||||||||||||||||||||||||||||||||||||
| "test_db.test_table_from_dir").foreach { t => | ||||||||||||||||||||||||||||||||||||||||||
| spark.sql(s"drop table if exists $t") | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| spark.sql("drop database if exists test_db") | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1442,6 +1448,34 @@ class SparkSQLLineageParserHelperSuite extends KyuubiFunSuite | |||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| test("test directory to table") { | ||||||||||||||||||||||||||||||||||||||||||
| val inputFile = getClass.getResource("/").getPath + "input_file" | ||||||||||||||||||||||||||||||||||||||||||
| val sourceFile = File(inputFile).createFile() | ||||||||||||||||||||||||||||||||||||||||||
| spark.sql( | ||||||||||||||||||||||||||||||||||||||||||
| s""" | ||||||||||||||||||||||||||||||||||||||||||
| |CREATE OR REPLACE TEMPORARY VIEW temp_view ( | ||||||||||||||||||||||||||||||||||||||||||
| | `a` STRING COMMENT '', | ||||||||||||||||||||||||||||||||||||||||||
| | `b` STRING COMMENT '' | ||||||||||||||||||||||||||||||||||||||||||
| |) USING csv OPTIONS( | ||||||||||||||||||||||||||||||||||||||||||
| | sep='\t', | ||||||||||||||||||||||||||||||||||||||||||
| | path='${sourceFile.path}' | ||||||||||||||||||||||||||||||||||||||||||
| |); | ||||||||||||||||||||||||||||||||||||||||||
| |""".stripMargin).collect() | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1455
to
+1463
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| val ret0 = extractLineageWithoutExecuting( | ||||||||||||||||||||||||||||||||||||||||||
| s""" | ||||||||||||||||||||||||||||||||||||||||||
| |INSERT OVERWRITE TABLE test_db.test_table_from_dir | ||||||||||||||||||||||||||||||||||||||||||
| |SELECT `a`, `b` FROM temp_view | ||||||||||||||||||||||||||||||||||||||||||
| |""".stripMargin) | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1468
to
+1469
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use UPPER CASE for SQL keywords, and format the SQL in a short readable way
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| assert(ret0 == Lineage( | ||||||||||||||||||||||||||||||||||||||||||
| List(), | ||||||||||||||||||||||||||||||||||||||||||
| List(s"spark_catalog.test_db.test_table_from_dir"), | ||||||||||||||||||||||||||||||||||||||||||
| List( | ||||||||||||||||||||||||||||||||||||||||||
| (s"spark_catalog.test_db.test_table_from_dir.a0", Set()), | ||||||||||||||||||||||||||||||||||||||||||
| (s"spark_catalog.test_db.test_table_from_dir.b0", Set())))) | ||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| private def extractLineageWithoutExecuting(sql: String): Lineage = { | ||||||||||||||||||||||||||||||||||||||||||
| val parsed = spark.sessionState.sqlParser.parsePlan(sql) | ||||||||||||||||||||||||||||||||||||||||||
| val analyzed = spark.sessionState.analyzer.execute(parsed) | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
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.
Uh oh!
There was an error while loading. Please reload this page.