Repository: spark
Updated Branches:
  refs/heads/master 25892f3cc -> 558f31b31

[SPARK-23963][SQL] Properly handle large number of columns in query on 
text-based Hive table

## What changes were proposed in this pull request?

TableReader would get disproportionately slower as the number of columns in the 
query increased.

I fixed the way TableReader was looking up metadata for each column in the row. 
Previously, it had been looking up this data in linked lists, accessing each 
linked list by an index (column number). Now it looks up this data in arrays, 
where indexing by column number works better.

## How was this patch tested?

Manual testing
All sbt unit tests
python sql tests

Author: Bruce Robbins <>

Closes #21043 from bersprockets/tabreadfix.


Branch: refs/heads/master
Commit: 558f31b31c73b7e9f26f56498b54cf53997b59b8
Parents: 25892f3
Author: Bruce Robbins <>
Authored: Fri Apr 13 14:05:04 2018 -0700
Committer: gatorsmile <>
Committed: Fri Apr 13 14:05:04 2018 -0700

 .../src/main/scala/org/apache/spark/sql/hive/TableReader.scala     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 
index cc8907a..b5444a4 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/TableReader.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/TableReader.scala
@@ -381,7 +381,7 @@ private[hive] object HadoopTableReader extends 
HiveInspectors with Logging {
     val (fieldRefs, fieldOrdinals) = { case (attr, 
ordinal) =>
       soi.getStructFieldRef( -> ordinal
-    }.unzip
+    }.toArray.unzip
      * Builds specific unwrappers ahead of time according to object inspector

To unsubscribe, e-mail:
For additional commands, e-mail:

Reply via email to