steveloughran commented on code in PR #15184:
URL: https://github.com/apache/iceberg/pull/15184#discussion_r2747848266


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java:
##########
@@ -761,7 +761,8 @@ public StructType readSchema() {
   }
 
   private BatchScan newBatchScan() {
-    if (table instanceof RequiresRemoteScanPlanning) {
+    if (table instanceof SupportsDistributedScanPlanning
+        && !((SupportsDistributedScanPlanning) 
table).allowDistributedPlanning()) {

Review Comment:
   you should be able do this in one go with java 14 pattefn matching
   
https://docs.oracle.com/en/java/javase/21/language/pattern-matching-instanceof.html#GUID-E8F57F2F-C14C-4822-9C70-7C76033D4331
   
   ```java
   if (table instanceof SupportsDistributedScanPlanning distributed
           && distributed.allowDistributedPlanning()) {
      ...
    }
   ```
   
   if you are really ambitious you could try guarded switch statements, which 
would be a lot more elegant
   



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