You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "yabola (via GitHub)" <gi...@apache.org> on 2025/09/01 12:50:26 UTC

[PR] [KYUUBI #7180][LINEAGE] Subquery in the project should drill down to get the column lineage relationships [kyuubi]

yabola opened a new pull request, #7181:
URL: https://github.com/apache/kyuubi/pull/7181

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/master/contributing/code/index.html
     2. If the PR is related to an issue in https://github.com/apache/kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug, and what versions are affected.
   -->
   The following SQL statement will get the wrong column lineage result:
   create table table0(a int, b string, c string)
   create table table1(a int, b string, c string)
   select (select sum(a) from table0 where table1.b = table0.b) as aa, b from table1
   
   The root cause:  
   From  https://github.com/apache/spark/pull/32687 ,  we can know the references for a subquery expression are defined as outer attribute references.  So we should always drill down to get the corresponding column lineage relationship for the subquery plan.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   add new ut
   
   ### Was this patch authored or co-authored using generative AI tooling?
   <!--
   If a generative AI tooling has been used in the process of authoring this patch, please include
   phrase 'Generated-by: ' followed by the name of the tool and its version.
   If no, write 'No'.
   Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
   -->
   
   no


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2675534260


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -124,19 +115,19 @@ trait LineageParser {
   }
 
   private def getSelectColumnLineage(
-      named: Seq[NamedExpression],
-      inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
+      named: Seq[NamedExpression]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
+          if (exp.references.isEmpty || exp.child.isInstanceOf[ScalarSubquery]) {
             val attrRefs = getExpressionSubqueryPlans(exp.child)
-              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet](), inputTablesByPlan))
+              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet]()))
               .foldLeft(ListMap[Attribute, AttributeSet]())(mergeColumnsLineage).values
               .foldLeft(AttributeSet.empty)(_ ++ _)
               .map(attr => attr.withQualifier(attr.qualifier :+ SUBQUERY_COLUMN_IDENTIFIER))
             AttributeSet(attrRefs)

Review Comment:
   This is a good catch. I add `exp.references`  and add more UT for this case.



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2675534260


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -124,19 +115,19 @@ trait LineageParser {
   }
 
   private def getSelectColumnLineage(
-      named: Seq[NamedExpression],
-      inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
+      named: Seq[NamedExpression]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
+          if (exp.references.isEmpty || exp.child.isInstanceOf[ScalarSubquery]) {
             val attrRefs = getExpressionSubqueryPlans(exp.child)
-              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet](), inputTablesByPlan))
+              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet]()))
               .foldLeft(ListMap[Attribute, AttributeSet]())(mergeColumnsLineage).values
               .foldLeft(AttributeSet.empty)(_ ++ _)
               .map(attr => attr.withQualifier(attr.qualifier :+ SUBQUERY_COLUMN_IDENTIFIER))
             AttributeSet(attrRefs)

Review Comment:
   This is a good catch. I add `exp.references` to the returned variables  and add more UT for this case.



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3242722659

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/7181?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 0.00%. Comparing base ([`f7e10e6`](https://app.codecov.io/gh/apache/kyuubi/commit/f7e10e65d3aca6fa82171bb3d75b7622c74807b7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4afb6a6`](https://app.codecov.io/gh/apache/kyuubi/commit/4afb6a697ebae91b65419440b8f11a9e9fabbcf9?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/kyuubi/pull/7181?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...in/lineage/helper/SparkSQLLineageParseHelper.scala](https://app.codecov.io/gh/apache/kyuubi/pull/7181?src=pr&el=tree&filepath=extensions%2Fspark%2Fkyuubi-spark-lineage%2Fsrc%2Fmain%2Fscala%2Forg%2Fapache%2Fkyuubi%2Fplugin%2Flineage%2Fhelper%2FSparkSQLLineageParseHelper.scala&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXh0ZW5zaW9ucy9zcGFyay9reXV1Ymktc3BhcmstbGluZWFnZS9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9wbHVnaW4vbGluZWFnZS9oZWxwZXIvU3BhcmtTUUxMaW5lYWdlUGFyc2VIZWxwZXIuc2NhbGE=) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/kyuubi/pull/7181?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@           Coverage Diff           @@
   ##           master   #7181    +/-   ##
   =======================================
     Coverage    0.00%   0.00%            
   =======================================
     Files         701     695     -6     
     Lines       43565   43434   -131     
     Branches     5911    5887    -24     
   =======================================
   + Misses      43565   43434   -131     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/kyuubi/pull/7181?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3703104841

   Thanks for the PR! This PR is being closed due to inactivity. This isn't a judgement on the merit of the PR in any way. If this is still an issue with the latest version of Kyuubi, please reopen it and ask a committer to remove the Stale tag!
   
   Thank you for using Kyuubi!


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2668326884


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -124,19 +115,19 @@ trait LineageParser {
   }
 
   private def getSelectColumnLineage(
-      named: Seq[NamedExpression],
-      inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
+      named: Seq[NamedExpression]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
+          if (exp.references.isEmpty || exp.child.isInstanceOf[ScalarSubquery]) {

Review Comment:
   Is it enough to simply check if exp.child is a ScalarSubquery? Do we need to recursively check the children of exp?
   
   For example, could you verify this sql?
   
   ```
   select if((select sum(a) from table0 where table1.b = table0.b) > 100, 1, 2) as aa, b from table1
   ```



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget closed pull request #7181: [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships
URL: https://github.com/apache/kyuubi/pull/7181


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2668383428


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -124,19 +115,19 @@ trait LineageParser {
   }
 
   private def getSelectColumnLineage(
-      named: Seq[NamedExpression],
-      inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
+      named: Seq[NamedExpression]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
+          if (exp.references.isEmpty || exp.child.isInstanceOf[ScalarSubquery]) {
             val attrRefs = getExpressionSubqueryPlans(exp.child)
-              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet](), inputTablesByPlan))
+              .map(extractColumnsLineage(_, ListMap[Attribute, AttributeSet]()))
               .foldLeft(ListMap[Attribute, AttributeSet]())(mergeColumnsLineage).values
               .foldLeft(AttributeSet.empty)(_ ++ _)
               .map(attr => attr.withQualifier(attr.qualifier :+ SUBQUERY_COLUMN_IDENTIFIER))
             AttributeSet(attrRefs)

Review Comment:
   Additionally, non-subquery references of exp may be ignored here.



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #7181: [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships
URL: https://github.com/apache/kyuubi/pull/7181


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3251545810

   @wForget @pan3793  please help review when you have time, thank you~


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2675543019


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -128,15 +128,17 @@ trait LineageParser {
       inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
+        val subqueryPlans = getExpressionSubqueryPlans(exp.child)
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
-            val attrRefs = getExpressionSubqueryPlans(exp.child)
+          if (exp.references.isEmpty || subqueryPlans.nonEmpty) {

Review Comment:
   `exp.references.isEmpty` is not needed.



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3728155598

   > @yabola can you rebase it since master moves forward a lot.
   Thank you for the review. I rebased master.
   


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3741363460

   Thanks @yabola , merged to master


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3728158407

   > @yabola can you rebase it since master moves forward a lot.
   
   Thank you for the review. I rebased master.


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2675583757


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -128,15 +128,17 @@ trait LineageParser {
       inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
+        val subqueryPlans = getExpressionSubqueryPlans(exp.child)
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
-            val attrRefs = getExpressionSubqueryPlans(exp.child)
+          if (exp.references.isEmpty || subqueryPlans.nonEmpty) {

Review Comment:
   Yes, this is redundant code, I deleted it.



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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3718363651

   @pan3793 Hi~ could you help review this when you have time? We had tested much other sql and didn't find more problems.


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#issuecomment-3718516071

   @yabola can you rebase it since master moves forward a lot.


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


Re: [PR] [KYUUBI #7180][LINEAGE] Subquery in the project should always drill down to get the lineage relationships [kyuubi]

Posted by "yabola (via GitHub)" <gi...@apache.org>.
yabola commented on code in PR #7181:
URL: https://github.com/apache/kyuubi/pull/7181#discussion_r2675528361


##########
extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala:
##########
@@ -124,19 +115,19 @@ trait LineageParser {
   }
 
   private def getSelectColumnLineage(
-      named: Seq[NamedExpression],
-      inputTablesByPlan: mutable.HashSet[String]): AttributeMap[AttributeSet] = {
+      named: Seq[NamedExpression]): AttributeMap[AttributeSet] = {
     val exps = named.map {
       case exp: Alias =>
         val references =
-          if (exp.references.nonEmpty) exp.references
-          else {
+          if (exp.references.isEmpty || exp.child.isInstanceOf[ScalarSubquery]) {

Review Comment:
   Thank you for your review. Yes, this problem exists. I add  recursively check for the children exp.



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