Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/11936#discussion_r57510032
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/orc/OrcRelation.scala ---
@@ -117,6 +123,66 @@ private[sql] class DefaultSource extends FileFormat
with DataSourceRegister {
val output =
StructType(requiredColumns.map(dataSchema(_))).toAttributes
OrcTableScan(sqlContext, output, filters, inputFiles).execute()
}
+
+ override def buildReader(
+ sqlContext: SQLContext,
+ partitionSchema: StructType,
+ dataSchema: StructType,
+ filters: Seq[Filter],
+ options: Map[String, String]): (PartitionedFile) =>
Iterator[InternalRow] = {
+ val orcConf = new
Configuration(sqlContext.sparkContext.hadoopConfiguration)
+
+ if (sqlContext.conf.orcFilterPushDown) {
+ // Sets pushed predicates
+ OrcFilters.createFilter(filters.toArray).foreach { f =>
+ orcConf.set(OrcTableScan.SARG_PUSHDOWN, f.toKryo)
+ orcConf.setBoolean(ConfVars.HIVEOPTINDEXFILTER.varname, true)
+ }
+ }
+
+ val broadcastedConf = sqlContext.sparkContext.broadcast(new
SerializableConfiguration(orcConf))
+
+ (file: PartitionedFile) => {
+ val conf = broadcastedConf.value.value
+
+ // SPARK-8501: Empty ORC files always have an empty schema stored in
their footer. In this
--- End diff --
Empty means the file doesn't contain any record, but it's length isn't zero
since ORC metadata takes spaces.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]