malinjawi commented on code in PR #12024:
URL: https://github.com/apache/gluten/pull/12024#discussion_r3201819413


##########
backends-velox/src-delta33/main/scala/org/apache/spark/sql/execution/datasources/v2/OffloadDeltaCommand.scala:
##########
@@ -45,4 +50,20 @@ case class OffloadDeltaCommand() extends OffloadSingleNode {
       case other => other
     }
   }
+
+  private def shouldOffloadOptimize(optimize: OptimizeTableCommand): Boolean = 
{
+    optimize.zOrderBy.isEmpty &&
+    optimize.optimizeContext.reorg.isEmpty &&
+    !optimize.optimizeContext.isFull &&
+    !isClusteredOptimize(optimize)
+  }
+
+  private def isClusteredOptimize(optimize: OptimizeTableCommand): Boolean = {
+    try {
+      val snapshot = getDeltaTable(optimize.child, "OPTIMIZE").update()
+      ClusteredTableUtils.isSupported(snapshot.protocol)
+    } catch {
+      case NonFatal(_) => true

Review Comment:
   @zhztheplayer Good find!
   
   Yea no exception needed here. I added this catch as a guard at first but 
after rechecking the path it is better to let `getDeltaTable(...).update() 
`fail normally if table resolution or snapshot loading fails. 
   
   Removed now.
   
   Let me know if that sounds sound.
   
   



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