peter-toth commented on a change in pull request #29737:
URL: https://github.com/apache/spark/pull/29737#discussion_r490349666
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/orc/OrcUtils.scala
##########
@@ -142,13 +142,17 @@ object OrcUtils extends Logging {
reader: Reader,
conf: Configuration): Option[(Array[Int], Boolean)] = {
val orcFieldNames = reader.getSchema.getFieldNames.asScala
+ val forcePositionalEvolution =
OrcConf.FORCE_POSITIONAL_EVOLUTION.getBoolean(conf)
if (orcFieldNames.isEmpty) {
// SPARK-8501: Some old empty ORC files always have an empty schema
stored in their footer.
None
} else {
- if (orcFieldNames.forall(_.startsWith("_col"))) {
- // This is a ORC file written by Hive, no field names in the physical
schema, assume the
- // physical schema maps to the data scheme by index.
+ if (forcePositionalEvolution ||
orcFieldNames.forall(_.startsWith("_col"))) {
+ // This is either an ORC file written by an old versions of Hive and
there are no field
+ // names in the physical schema, or a file written by a newer versions
of Hive where
+ // `orc.force.positional.evolution=true` and columns were renamed so
the physical schema
Review comment:
Indeed, thanks. Fixed the comment.
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/orc/OrcUtils.scala
##########
@@ -142,13 +142,17 @@ object OrcUtils extends Logging {
reader: Reader,
conf: Configuration): Option[(Array[Int], Boolean)] = {
val orcFieldNames = reader.getSchema.getFieldNames.asScala
+ val forcePositionalEvolution =
OrcConf.FORCE_POSITIONAL_EVOLUTION.getBoolean(conf)
if (orcFieldNames.isEmpty) {
// SPARK-8501: Some old empty ORC files always have an empty schema
stored in their footer.
None
} else {
- if (orcFieldNames.forall(_.startsWith("_col"))) {
- // This is a ORC file written by Hive, no field names in the physical
schema, assume the
- // physical schema maps to the data scheme by index.
+ if (forcePositionalEvolution ||
orcFieldNames.forall(_.startsWith("_col"))) {
+ // This is either an ORC file written by an old versions of Hive and
there are no field
Review comment:
Fixed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]