Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10604#discussion_r49810775
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/sources/interfaces.scala ---
    @@ -664,6 +669,32 @@ abstract class HadoopFsRelation private[sql](
         })
       }
     
    +  /**
    +   * Groups the input files by bucket id, if bucketing is enabled and this 
data source is bucketed.
    +   * Returns None if there exists any malformed bucket files.
    +   */
    +  private def groupBucketFiles(
    +      files: Array[FileStatus]): Option[scala.collection.Map[Int, 
Array[FileStatus]]] = {
    +    malformedBucketFile = false
    +    if (getBucketSpec.isDefined) {
    +      val groupedBucketFiles = mutable.HashMap.empty[Int, 
mutable.ArrayBuffer[FileStatus]]
    +      for (file <- files) {
    +        val bucketId = BucketingUtils.getBucketId(file.getPath.getName)
    +        if (bucketId.isEmpty) {
    +          logError(s"File ${file.getPath} is supposed to be a bucket file, 
but there is no " +
    +            "bucket id information in file name, fallback to non-bucketing 
mode.")
    +          malformedBucketFile = true
    +          return None
    --- End diff --
    
    you can consider just walking through the data in two passes. the first 
pass to find the error, and the second pass to do the grouping.



---
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]

Reply via email to