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


##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:
##########
@@ -66,10 +68,31 @@ class VeloxIteratorApi extends IteratorApi with Logging {
     ) {
       localFilesNode.setFileSchema(fileSchema)
     }
+    columnMappingMode(fileFormat).foreach(localFilesNode.setColumnMappingMode)
 
     localFilesNode
   }
 
+  private def columnMappingMode(fileFormat: ReadFileFormat): 
Option[ColumnMappingMode] = {
+    fileFormat match {
+      case ReadFileFormat.OrcReadFormat | ReadFileFormat.DwrfReadFormat =>
+        val defaultForcePosition =
+          org.apache.spark.SparkEnv.get.conf.get(
+            GlutenConfig.SPARK_ORC_FORCE_POSITIONAL_EVOLUTION,
+            "false")
+        val forcePosition =
+          SQLConf.get
+            .getConfString(GlutenConfig.SPARK_ORC_FORCE_POSITIONAL_EVOLUTION, 
defaultForcePosition)
+            .toBoolean
+        Some(if (forcePosition) ColumnMappingMode.POSITION else 
ColumnMappingMode.NAME)
+        Some(
+          if (VeloxConfig.get.parquetUseColumnNames) ColumnMappingMode.NAME
+          else ColumnMappingMode.POSITION)
+      case _ =>
+        None
+    }
+  }

Review Comment:
   `columnMappingMode` currently returns a value twice in the ORC/DWRF branch. 
The second `Some(...)` is unreachable/unused (the first `Some(...)` is 
discarded), and Parquet never gets a mapping-mode set. This will cause ORC/DWRF 
to always use the Parquet config and prevent per-format mapping from working as 
intended.



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