You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/08/24 13:19:08 UTC
[GitHub] [spark] maropu commented on a change in pull request #29473: [SPARK-32656][SQL] Repartition bucketed tables for sort merge join / shuffled hash join if applicable
maropu commented on a change in pull request #29473:
URL: https://github.com/apache/spark/pull/29473#discussion_r475587292
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala
##########
@@ -166,15 +167,24 @@ case class FileSourceScanExec(
requiredSchema: StructType,
partitionFilters: Seq[Expression],
optionalBucketSet: Option[BitSet],
- optionalNumCoalescedBuckets: Option[Int],
+ optionalNewNumBuckets: Option[Int],
dataFilters: Seq[Expression],
tableIdentifier: Option[TableIdentifier])
extends DataSourceScanExec {
// Note that some vals referring the file-based relation are lazy intentionally
// so that this plan can be canonicalized on executor side too. See SPARK-23731.
override lazy val supportsColumnar: Boolean = {
- relation.fileFormat.supportBatch(relation.sparkSession, schema)
+ // `RepartitioningBucketRDD` converts columnar batches to rows to calculate bucket id for each
+ // row, thus columnar is not supported when `RepartitioningBucketRDD` is used to avoid
+ // conversions from batches to rows and back to batches.
+ relation.fileFormat.supportBatch(relation.sparkSession, schema) && !isRepartitioningBuckets
Review comment:
I'm not sure about how much this columnar execution makes performance gains though, the proposed idea is to give up the gains then use bucket repartitioning instead?
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/bucketing/CoalesceOrRepartitionBucketsInJoin.scala
##########
@@ -83,23 +82,39 @@ case class CoalesceBucketsInJoin(conf: SQLConf) extends Rule[SparkPlan] {
}
def apply(plan: SparkPlan): SparkPlan = {
- if (!conf.coalesceBucketsInJoinEnabled) {
+ if (!conf.coalesceBucketsInJoinEnabled && !conf.repartitionBucketsInJoinEnabled) {
return plan
}
+ if (conf.coalesceBucketsInJoinEnabled && conf.repartitionBucketsInJoinEnabled) {
+ throw new AnalysisException("Both 'spark.sql.bucketing.coalesceBucketsInJoin.enabled' and " +
+ "'spark.sql.bucketing.repartitionBucketsInJoin.enabled' cannot be set to true at the" +
+ "same time")
Review comment:
Could we use `Enumeration` and `checkValues` instead? I think this check should be done in `SQLConf`.
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala
##########
@@ -166,15 +167,24 @@ case class FileSourceScanExec(
requiredSchema: StructType,
partitionFilters: Seq[Expression],
optionalBucketSet: Option[BitSet],
- optionalNumCoalescedBuckets: Option[Int],
+ optionalNewNumBuckets: Option[Int],
dataFilters: Seq[Expression],
tableIdentifier: Option[TableIdentifier])
extends DataSourceScanExec {
// Note that some vals referring the file-based relation are lazy intentionally
// so that this plan can be canonicalized on executor side too. See SPARK-23731.
override lazy val supportsColumnar: Boolean = {
- relation.fileFormat.supportBatch(relation.sparkSession, schema)
+ // `RepartitioningBucketRDD` converts columnar batches to rows to calculate bucket id for each
+ // row, thus columnar is not supported when `RepartitioningBucketRDD` is used to avoid
+ // conversions from batches to rows and back to batches.
+ relation.fileFormat.supportBatch(relation.sparkSession, schema) && !isRepartitioningBuckets
+ }
+
+ @transient private lazy val isRepartitioningBuckets: Boolean = {
Review comment:
nit: we don't need `: Boolean `?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org