anuragmantri commented on code in PR #55518:
URL: https://github.com/apache/spark/pull/55518#discussion_r4485022205


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2Commands.scala:
##########
@@ -356,6 +357,32 @@ trait RowLevelWrite extends V2WriteCommand with 
SupportsSubquery {
   def condition: Expression
   def originalTable: NamedRelation
 
+  /** The projections that read query columns by ordinal. */
+  protected def queryProjections: Seq[ProjectingInternalRow]
+
+  /**
+   * The write reads the operation column at ordinal 0 and other query columns 
only through
+   * projections, by ordinal. Any other query column can be pruned with 
[[withPrunedQuery]].
+   */
+  override lazy val references: AttributeSet = {
+    val output = query.output.toIndexedSeq
+    val readOrdinals = 0 +: queryProjections.flatMap(_.colOrdinals)
+    AttributeSet(readOrdinals.map { ordinal =>
+      if (!output.isDefinedAt(ordinal)) {
+        throw SparkException.internalError(

Review Comment:
   Done in d406c8b0e00.



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