Skip to content

Commit 379b0b0

Browse files
committed
[SPARK-20283][SQL] Add preOptimizationBatches
## What changes were proposed in this pull request? We currently have postHocOptimizationBatches, but not preOptimizationBatches. This patch adds preOptimizationBatches so the optimizer debugging extensions are symmetric. ## How was this patch tested? N/A Author: Reynold Xin <[email protected]> Closes #17595 from rxin/SPARK-20283.
1 parent a35b9d9 commit 379b0b0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sql/core/src/main/scala/org/apache/spark/sql/execution/SparkOptimizer.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ class SparkOptimizer(
3030
experimentalMethods: ExperimentalMethods)
3131
extends Optimizer(catalog, conf) {
3232

33-
override def batches: Seq[Batch] = (super.batches :+
33+
override def batches: Seq[Batch] = (preOptimizationBatches ++ super.batches :+
3434
Batch("Optimize Metadata Only Query", Once, OptimizeMetadataOnlyQuery(catalog, conf)) :+
3535
Batch("Extract Python UDF from Aggregate", Once, ExtractPythonUDFFromAggregate) :+
3636
Batch("Prune File Source Table Partitions", Once, PruneFileSourcePartitions)) ++
3737
postHocOptimizationBatches :+
3838
Batch("User Provided Optimizers", fixedPoint, experimentalMethods.extraOptimizations: _*)
3939

40+
/**
41+
* Optimization batches that are executed before the regular optimization batches (also before
42+
* the finish analysis batch).
43+
*/
44+
def preOptimizationBatches: Seq[Batch] = Nil
45+
4046
/**
4147
* Optimization batches that are executed after the regular optimization batches, but before the
4248
* batch executing the [[ExperimentalMethods]] optimizer rules. This hook can be used to add

0 commit comments

Comments
 (0)