From 58887dcb7941df2c99a33432d7fa49b1d45b6087 Mon Sep 17 00:00:00 2001 From: Angerszhuuuu Date: Thu, 7 Dec 2023 18:07:13 +0800 Subject: [PATCH] [KYUUBI #5827][TEST] Fix wrong test code about directory lineage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes #5827 ## Describe Your Solution ๐Ÿ”ง Fix wrong test code about directory lineage ## Types of changes :bookmark: - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklists ## ๐Ÿ“ Author Self Checklist - [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project - [x] I have performed a self-review - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) ## ๐Ÿ“ Committer Pre-Merge Checklist - [x] Pull request title is okay. - [x] No license issues. - [x] Milestone correctly set? - [x] Test coverage is ok - [x] Assignees are selected. - [x] Minimum number of approvals - [x] No changes are requested **Be nice. Be informative.** Closes #5829 from AngersZhuuuu/KYUUBI-5827. Closes #5827 007981c57 [Angerszhuuuu] [KYUUBI #5827][TEST]Fix wrong test code about directory lineage Authored-by: Angerszhuuuu Signed-off-by: Cheng Pan --- .../SparkSQLLineageParserHelperSuite.scala | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParserHelperSuite.scala b/extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParserHelperSuite.scala index 3c19163db..761274379 100644 --- a/extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParserHelperSuite.scala +++ b/extensions/spark/kyuubi-spark-lineage/src/test/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParserHelperSuite.scala @@ -472,32 +472,36 @@ class SparkSQLLineageParserHelperSuite extends KyuubiFunSuite val tableDirectory = getClass.getResource("/").getPath + "table_directory" val directory = File(tableDirectory).createDirectory() val ret0 = extractLineage(s""" - |INSERT OVERWRITE DIRECTORY '$directory.path' + |INSERT OVERWRITE DIRECTORY '${directory.path}' |USING parquet |SELECT * FROM test_db0.test_table_part0""".stripMargin) assert(ret0 == Lineage( List(s"$DEFAULT_CATALOG.test_db0.test_table_part0"), - List(s"""`$directory.path`"""), + List(s"""`${directory.path}`"""), List( - (s"""`$directory.path`.key""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.key")), - (s"""`$directory.path`.value""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.value")), - (s"""`$directory.path`.pid""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.pid"))))) + (s"""`${directory.path}`.key""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.key")), + ( + s"""`${directory.path}`.value""", + Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.value")), + (s"""`${directory.path}`.pid""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.pid"))))) } test("columns lineage extract - InsertIntoHiveDirCommand") { val tableDirectory = getClass.getResource("/").getPath + "table_directory" val directory = File(tableDirectory).createDirectory() val ret0 = extractLineage(s""" - |INSERT OVERWRITE DIRECTORY '$directory.path' + |INSERT OVERWRITE DIRECTORY '${directory.path}' |USING parquet |SELECT * FROM test_db0.test_table_part0""".stripMargin) assert(ret0 == Lineage( List(s"$DEFAULT_CATALOG.test_db0.test_table_part0"), - List(s"""`$directory.path`"""), + List(s"""`${directory.path}`"""), List( - (s"""`$directory.path`.key""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.key")), - (s"""`$directory.path`.value""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.value")), - (s"""`$directory.path`.pid""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.pid"))))) + (s"""`${directory.path}`.key""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.key")), + ( + s"""`${directory.path}`.value""", + Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.value")), + (s"""`${directory.path}`.pid""", Set(s"$DEFAULT_CATALOG.test_db0.test_table_part0.pid"))))) } test("columns lineage extract - InsertIntoHiveTable") {