Copilot commented on code in PR #12400:
URL: https://github.com/apache/gluten/pull/12400#discussion_r3549538572


##########
backends-velox/src/main/scala/org/apache/gluten/config/VeloxConfig.scala:
##########
@@ -530,10 +531,35 @@ object VeloxConfig extends ConfigRegistry {
   val COLUMNAR_VELOX_FILE_HANDLE_CACHE_ENABLED =
     
buildStaticConf("spark.gluten.sql.columnar.backend.velox.fileHandleCacheEnabled")
       .doc(
-        "Disables caching if false. File handle cache should be disabled " +
-          "if files are mutable, i.e. file content may change while file path 
stays the same.")
+        "Enables caching of file handles to avoid repeated open/close overhead 
on remote " +
+          "filesystems. Should be disabled if files are mutable, i.e. file 
content may " +
+          "change while file path stays the same.")
       .booleanConf
-      .createWithDefault(false)
+      .createWithDefault(true)
+
+  val COLUMNAR_VELOX_NUM_CACHE_FILE_HANDLES =
+    
buildStaticConf("spark.gluten.sql.columnar.backend.velox.numCacheFileHandles")
+      .doc(
+        "Maximum number of entries in the file handle cache. Each entry holds 
an open " +
+          "file descriptor (local FS) or connection state (remote FS). Note 
that on " +
+          "local filesystems, high values may approach the OS file descriptor 
limit " +
+          "(ulimit -n). On remote object stores (S3, ABFS, GCS) entries 
represent " +
+          "network connections/sockets rather than per-file OS file 
descriptors, but " +
+          "they can still count toward OS resource limits (ulimit -n).")
+      .intConf
+      .checkValue(_ > 0, "must be a positive number")
+      .createWithDefault(10000)
+
+  val COLUMNAR_VELOX_FILE_HANDLE_EXPIRATION_DURATION_MS =
+    
buildStaticConf("spark.gluten.sql.columnar.backend.velox.fileHandleExpirationDurationMs")
+      .doc(
+        "Expiration time in milliseconds for cached file handles. Handles not 
accessed " +
+          "within this duration are evicted from the cache. This prevents 
stale handles " +
+          "from accumulating (e.g., expired HDFS leases, closed remote 
connections). " +
+          "A value of 0 disables TTL-based eviction.")
+      .timeConf(TimeUnit.MILLISECONDS)
+      .checkValue(_ >= 0, "must be a non-negative number (0 disables TTL-based 
eviction)")
+      .createWithDefault(600000L) // 10 minutes

Review Comment:
   `fileHandleExpirationDurationMs` is defined as a Spark `timeConf`, which 
accepts values like `10m`/`600000ms`. However, this value is forwarded to 
native as a raw string map and read via `conf->get<int64_t>(...)` (see 
ConfigExtractor), which will only parse plain integers. This can make valid 
Spark-side values fail at native init time. Consider making this config a plain 
`longConf` (milliseconds) so invalid unit-suffixed values are rejected early 
and consistently.



##########
docs/velox-configuration.md:
##########
@@ -30,7 +30,8 @@ nav_order: 16
 | spark.gluten.sql.columnar.backend.velox.directorySizeGuess                   
    | ⚓ Static      | 32KB              | Deprecated, rename to 
spark.gluten.sql.columnar.backend.velox.footerEstimatedSize                     
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                    
                 |
 | spark.gluten.sql.columnar.backend.velox.driverSideBroadcastHashTableBuild    
    | 🔄 Dynamic    | false             | Enable driver-side broadcast hash 
table build. When enabled, the hash table is built and serialized on the 
driver, then broadcast to executors. When disabled, each executor builds its 
own hash table from the broadcast data.                                         
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                  
                 |
 | spark.gluten.sql.columnar.backend.velox.enableTimestampNtzValidation         
    | 🔄 Dynamic    | false             | Enable validation fallback for 
TimestampNTZ type. When true, any plan containing TimestampNTZ will fall back 
to Spark execution. When false, allows native execution for TimestampNTZ scan.  
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                             
                 |
-| spark.gluten.sql.columnar.backend.velox.fileHandleCacheEnabled               
    | ⚓ Static      | false             | Disables caching if false. File 
handle cache should be disabled if files are mutable, i.e. file content may 
change while file path stays the same.                                          
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                              
                 |
+| spark.gluten.sql.columnar.backend.velox.fileHandleCacheEnabled               
    | ⚓ Static      | true              | Enables caching of file handles to 
avoid repeated open/close overhead on remote filesystems. Should be disabled if 
files are mutable, i.e. file content may change while file path stays the same. 
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                       
                 |
+| spark.gluten.sql.columnar.backend.velox.fileHandleExpirationDurationMs       
    | ⚓ Static      | 600000ms          | Expiration time in milliseconds for 
cached file handles. Handles not accessed within this duration are evicted from 
the cache. This prevents stale handles from accumulating (e.g., expired HDFS 
leases, closed remote connections). A value of 0 disables TTL-based eviction.   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                         
                 |

Review Comment:
   The docs default `600000ms` suggests unit-suffixed values are expected for 
this config, but the native layer reads it as an integer millisecond value. To 
avoid users copying an invalid value (e.g., `600000ms`) into SparkConf and then 
failing native parsing, document the default as a plain millisecond integer.



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