wypoon commented on code in PR #7733:
URL: https://github.com/apache/iceberg/pull/7733#discussion_r1273983799


##########
spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java:
##########
@@ -73,7 +73,12 @@ public boolean caseSensitive() {
 
   public boolean localityEnabled() {
     boolean defaultValue = Util.mayHaveBlockLocations(table.io(), 
table.location());
-    return PropertyUtil.propertyAsBoolean(readOptions, 
SparkReadOptions.LOCALITY, defaultValue);
+    return confParser
+        .booleanConf()
+        .option(SparkReadOptions.LOCALITY)
+        .sessionConf(SparkSQLProperties.LOCALITY_ENABLED)
+        .defaultValue(defaultValue)
+        .parse();

Review Comment:
   On further thought, I think it would be better to do
   ```
       if (defaultValue) {
         return confParser
             .booleanConf()
             .option(SparkReadOptions.LOCALITY)
             .sessionConf(SparkSQLProperties.LOCALITY_ENABLED)
             .defaultValue(true)
             .parse();
       } else {
         return false;
       }
   ```
   If defaultValue is false, then locality should be disabled, regardless of 
the option or session conf, as block locations will not be available.



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