pan3793 commented on code in PR #6911: URL: https://github.com/apache/kyuubi/pull/6911#discussion_r1950573732
########## extensions/spark/kyuubi-spark-lineage/src/main/scala/org/apache/kyuubi/plugin/lineage/helper/SparkSQLLineageParseHelper.scala: ########## @@ -177,7 +177,9 @@ trait LineageParser { val mergedRelationColumnLineage = { relationOutput.foldLeft((ListMap[Attribute, AttributeSet](), relationColumnLineage)) { case ((acc, x), attr) => - (acc + (attr -> x.head._2), x.tail) + val head_2 = if (x.isEmpty) AttributeSet.empty else x.head._2 + val tail = if (x.isEmpty) x.empty else x.tail + (acc + (attr -> head_2), tail) Review Comment: maybe can be write in ``` relationOutput.foldLeft((ListMap[Attribute, AttributeSet](), relationColumnLineage)) { case ((acc, x), attr) if x.isEmpty => (acc + (attr -> AttributeSet.empty), x.tail) case ((acc, x), attr) => (acc + (attr -> x.head._2), x.tail) }._1 ``` TBH, the code is not much readable ... -- 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-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org