You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/05 08:20:08 UTC

[GitHub] [incubator-kyuubi] iodone commented on a diff in pull request #3736: [KYUUBI #3735] Support extracting lineage from `CACHE table` context

iodone commented on code in PR #3736:
URL: https://github.com/apache/incubator-kyuubi/pull/3736#discussion_r1039281032


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -301,6 +318,20 @@ trait LineageParser {
       case p: LocalRelation =>
         joinRelationColumnLineage(parentColumnsLineage, p.output, Seq(LOCAL_TABLE_IDENTIFIER))
 
+      case p: InMemoryRelation =>
+        val tableName = p.cacheBuilder.tableName.get
+        sparkSession.sessionState.catalog.getTempView(tableName) match {
+          case Some(viewPlan) =>
+            val child = getPlanField[Project]("child", viewPlan)
+            val qe = sparkSession.sessionState.executePlan(child)
+            val queryPlan = sparkSession.sessionState.optimizer.execute(qe.analyzed)
+            val relationColumnLineage =
+              extractColumnsLineage(queryPlan, ListMap[Attribute, AttributeSet]())
+            mergeRelationColumnLineage(parentColumnsLineage, p.output, relationColumnLineage)

Review Comment:
   The merge here is two different logical plans, their attribute ids are not globally unique and need to be related by a column of the same name



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org