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


##########
gluten-substrait/src/main/scala/org/apache/gluten/config/GlutenConfig.scala:
##########
@@ -576,6 +578,19 @@ object GlutenConfig extends ConfigRegistry {
       }
       .foreach { case (k, v) => nativeConfMap.put(k, v) }
 
+    // When `orc.force.positional.evolution=true`, vanilla Spark maps ORC 
columns by
+    // position rather than by name (see OrcUtils.requestedColumnIds). The 
Velox ORC reader
+    // must do the same, otherwise name-based matching against a mismatched 
file schema
+    // reads columns back as null/empty. Override the (Velox) 
orcUseColumnNames session conf
+    // so native reads ORC by position too. Harmless for backends that ignore 
this key.
+    // String literal is used because gluten-substrait cannot depend on 
backends-velox.
+    if (
+      backendName == "velox" &&
+      conf.getOrElse(SPARK_ORC_FORCE_POSITIONAL_EVOLUTION, "false").toBoolean
+    ) {
+      
nativeConfMap.put("spark.gluten.sql.columnar.backend.velox.orcUseColumnNames", 
"false")
+    }

Review Comment:
   PR description says this fixes #12232, but the issue also calls out the 
Spark behavior of forcing positional mapping when the ORC file schema uses 
legacy positional names (all fields like `_col0`, `_col1`, …), even if 
`orc.force.positional.evolution` is not set. The current change only gates on 
`spark.hadoop.orc.force.positional.evolution`, so the `_col*`-schema scenario 
described in the issue likely remains incorrect under Velox unless users 
explicitly set the flag.



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