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

    https://github.com/apache/spark/pull/10604#discussion_r49762286
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/ExistingRDD.scala ---
    @@ -130,6 +132,23 @@ private[sql] object PhysicalRDD {
           metadata: Map[String, String] = Map.empty): PhysicalRDD = {
         // All HadoopFsRelations output UnsafeRows
         val outputUnsafeRows = relation.isInstanceOf[HadoopFsRelation]
    -    PhysicalRDD(output, rdd, relation.toString, metadata, outputUnsafeRows)
    +
    +    val bucketSpec = relation match {
    +      case r: HadoopFsRelation if 
relation.sqlContext.conf.bucketingEnabled() => r.bucketSpec
    +      case _ => None
    +    }
    +
    +    def toAttribute(colName: String): Attribute = output.find(_.name == 
colName).get
    +
    +    val bucketedPhysicalRDD = bucketSpec.map { spec =>
    +      val numBuckets = spec.numBuckets
    +      val bucketColumns = spec.bucketColumnNames.map(toAttribute)
    +      val partitioning = HashPartitioning(bucketColumns, numBuckets)
    +      PhysicalRDD(output, rdd, relation.toString, metadata, 
outputUnsafeRows, partitioning)
    +    }
    +
    +    bucketedPhysicalRDD.getOrElse(
    --- End diff --
    
    Maybe combine this with the previous block to make it clearer that this 
just depends on bucketSpec


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