cloud-fan commented on code in PR #38005:
URL: https://github.com/apache/spark/pull/38005#discussion_r1024306166


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/RewriteRowLevelCommand.scala:
##########
@@ -68,4 +73,58 @@ trait RewriteRowLevelCommand extends Rule[LogicalPlan] {
       operation.requiredMetadataAttributes,
       relation)
   }
+
+  protected def resolveRowIdAttrs(
+      relation: DataSourceV2Relation,
+      operation: RowLevelOperation): Seq[AttributeReference] = {
+
+    operation match {
+      case supportsDelta: SupportsDelta =>
+        val rowIdAttrs = V2ExpressionUtils.resolveRefs[AttributeReference](
+          supportsDelta.rowId,
+          relation)
+
+        val nullableRowIdAttrs = rowIdAttrs.filter(_.nullable)
+        if (nullableRowIdAttrs.nonEmpty) {
+          throw QueryCompilationErrors.nullableRowIdError(nullableRowIdAttrs)
+        }
+
+        rowIdAttrs
+
+      case _ =>
+        throw 
QueryCompilationErrors.notDeltaBasedRowLevelOperationError(operation)

Review Comment:
   this should never happen, we can throw `SparkException.internalError` 
directly.



-- 
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: reviews-unsubscr...@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to