bersprockets commented on a change in pull request #29737:
URL: https://github.com/apache/spark/pull/29737#discussion_r490289663
##########
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:
Super tiny nit (feel free to ignore if it doesn't make sense to you). I
suggest:
`orc.force.positional.evolution=true` (possibly because columns were renamed
so the physical schema doesn't match the data schema).
Your current version of the comment implies
orc.force.positional.evolution=true will happen when the columns are renamed.
But you can set orc.force.positional.evolution=true anytime, and you can rename
the columns and neglect to set orc.force.positional.evolution, correct?
##########
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:
Super tiny nit: "written by an old versions of Hive" should be
written by an old version of Hive
or
written by old versions of Hive
----------------------------------------------------------------
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]