ulysses-you commented on code in PR #4932:
URL: https://github.com/apache/kyuubi/pull/4932#discussion_r1226014114


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -476,6 +478,27 @@ trait LineageParser {
   }
 
   private def getQuery(plan: LogicalPlan): LogicalPlan = 
getField[LogicalPlan](plan, "query")
+
+  private def getV2TableName(plan: NamedRelation): String = {
+    plan match {
+      case relation: DataSourceV2ScanRelation =>
+        val catalog = relation.relation.catalog.get.name()
+        val database = 
relation.relation.identifier.get.namespace().mkString(".")
+        val table = relation.relation.identifier.get.name()
+        s"$catalog.$database.$table"
+      case relation: DataSourceV2Relation =>
+        val catalog = relation.catalog.get.name()
+        val database = relation.identifier.get.namespace().mkString(".")
+        val table = relation.identifier.get.name()
+        s"$catalog.$database.$table"
+      case _ =>
+        plan.name
+    }
+  }
+
+  private def getV1TableName(tableName: String): String = {
+    Seq(LineageConf.DEFAULT_CATALOG, 
tableName).filter(_.nonEmpty).mkString(".")

Review Comment:
   ```suggestion
     private def getV1TableName(qualifiedName: String): String = {
       Seq(LineageConf.DEFAULT_CATALOG, 
qualifiedName).filter(_.nonEmpty).mkString(".")
   ```



##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -476,6 +478,27 @@ trait LineageParser {
   }
 
   private def getQuery(plan: LogicalPlan): LogicalPlan = 
getField[LogicalPlan](plan, "query")
+
+  private def getV2TableName(plan: NamedRelation): String = {
+    plan match {
+      case relation: DataSourceV2ScanRelation =>
+        val catalog = relation.relation.catalog.get.name()

Review Comment:
   Can `catalog` be none ?



-- 
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]

Reply via email to