Github user liancheng commented on a diff in the pull request:
https://github.com/apache/spark/pull/7238#discussion_r35408700
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/parquet/newParquet.scala ---
@@ -345,6 +348,28 @@ private[sql] class ParquetRelation2(
// Schema of the whole table, including partition columns.
var schema: StructType = _
+ def filterDataStatusesWithoutSummaries(
+ leaves: Seq[FileStatus],
+ dataStatuses: Seq[FileStatus]): Seq[FileStatus] = {
+
+ // Get the partitions that have summary files
+ val typeInference =
sqlContext.conf.partitionColumnTypeInferenceEnabled()
+ val summariesPaths = metadataStatuses.map(_.getPath.getParent()) ++
+ commonMetadataStatuses.map(_.getPath.getParent())
+ val summariesPartitions =
PartitioningUtils.parsePartitions(summariesPaths,
+ PartitioningUtils.DEFAULT_PARTITION_NAME,
typeInference).partitions.toSet
+
+ dataStatuses.filterNot { d =>
+ val part =
PartitioningUtils.parsePartitions(Seq(d.getPath.getParent()),
+ PartitioningUtils.DEFAULT_PARTITION_NAME, typeInference)
--- End diff --
Parsing partitions over a single path is dangerous. For example, consider a
partition column whose values are hex number strings:
```
/base/p=01
/base/p=0a
```
When dealing with the first path only, the column type is inferred to be
`IntegerType`. But when you take both paths into consideration, the column type
turns to `StringType` instead.
---
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]