[SPARK-26226][SQL] Track optimization phase for streaming queries
## What changes were proposed in this pull request? In an earlier PR, we missed measuring the optimization phase time for streaming queries. This patch adds it. ## How was this patch tested? Given this is a debugging feature, and it is very convoluted to add tests to verify the phase is set properly, I am not introducing a streaming specific test. Closes #23193 from rxin/SPARK-26226-1. Authored-by: Reynold Xin <rxin@databricks.com> Signed-off-by: gatorsmile <gatorsmile@gmail.com>
This commit is contained in:
parent
60e4239a1e
commit
55c9685810
|
@ -22,6 +22,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
|||
|
||||
import org.apache.spark.internal.Logging
|
||||
import org.apache.spark.sql.{AnalysisException, SparkSession, Strategy}
|
||||
import org.apache.spark.sql.catalyst.QueryPlanningTracker
|
||||
import org.apache.spark.sql.catalyst.expressions.{CurrentBatchTimestamp, ExpressionWithRandomSeed}
|
||||
import org.apache.spark.sql.catalyst.plans.logical._
|
||||
import org.apache.spark.sql.catalyst.plans.physical.{AllTuples, ClusteredDistribution, HashPartitioning, SinglePartition}
|
||||
|
@ -73,7 +74,8 @@ class IncrementalExecution(
|
|||
* Walk the optimized logical plan and replace CurrentBatchTimestamp
|
||||
* with the desired literal
|
||||
*/
|
||||
override lazy val optimizedPlan: LogicalPlan = {
|
||||
override
|
||||
lazy val optimizedPlan: LogicalPlan = tracker.measurePhase(QueryPlanningTracker.OPTIMIZATION) {
|
||||
sparkSession.sessionState.optimizer.execute(withCachedData) transformAllExpressions {
|
||||
case ts @ CurrentBatchTimestamp(timestamp, _, _) =>
|
||||
logInfo(s"Current batch timestamp = $timestamp")
|
||||
|
|
Loading…
Reference in a new issue