cloud-fan commented on a change in pull request #23766: [SPARK-26859][SQL] Fix 
field writer index bug in non-vectorized ORC deserializer
URL: https://github.com/apache/spark/pull/23766#discussion_r257086192
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/orc/OrcDeserializer.scala
 ##########
 @@ -47,18 +47,20 @@ class OrcDeserializer(
       }.toArray
   }
 
-  private val validColIds = requestedColIds.filterNot(_ == -1)
-
   def deserialize(orcStruct: OrcStruct): InternalRow = {
-    var i = 0
-    while (i < validColIds.length) {
-      val value = orcStruct.getFieldValue(validColIds(i))
-      if (value == null) {
-        resultRow.setNullAt(i)
-      } else {
-        fieldWriters(i)(value)
+    var fieldWriterIndex = 0
+    var targetColumnIndex = 0
+    while (targetColumnIndex < requestedColIds.length) {
 
 Review comment:
   In performance critical code path, we should prefer the java style, i.e. 
using null instead of `Option` to avoid overhead.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to