Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19982#discussion_r157119941
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/BenchmarkQueryTest.scala ---
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.sql
+
+import org.scalatest.BeforeAndAfterAll
+
+import org.apache.spark.sql.catalyst.expressions.codegen.{CodeFormatter,
CodeGenerator}
+import org.apache.spark.sql.catalyst.rules.RuleExecutor
+import org.apache.spark.sql.execution.{SparkPlan, WholeStageCodegenExec}
+import org.apache.spark.sql.test.SharedSQLContext
+import org.apache.spark.util.Utils
+
+abstract class BenchmarkQueryTest extends QueryTest with SharedSQLContext
with BeforeAndAfterAll {
+
+ // When Utils.isTesting is true, the RuleExecutor will issue an
exception when hitting
+ // the max iteration of analyzer/optimizer batches.
+ assert(Utils.isTesting, "spark.testing is not set to true")
+
+ /**
+ * Drop all the tables
+ */
+ protected override def afterAll(): Unit = {
+ try {
+ // For debugging dump some statistics about how much time was spent
in various optimizer rules
+ logWarning(RuleExecutor.dumpTimeSpent())
--- End diff --
This is just to give the overall picture how long each rule takes.
I plan to submit another PR to track which rule takes an effect for a
specific query and also record the time cost.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]