maropu commented on a change in pull request #29270: URL: https://github.com/apache/spark/pull/29270#discussion_r469109288
########## File path: sql/core/src/test/scala/org/apache/spark/sql/PlanStabilitySuite.scala ########## @@ -0,0 +1,312 @@ +/* + * 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 java.io.File +import java.nio.charset.StandardCharsets + +import scala.collection.mutable + +import org.apache.commons.io.FileUtils + +import org.apache.spark.sql.catalyst.expressions.AttributeSet +import org.apache.spark.sql.catalyst.util._ +import org.apache.spark.sql.execution._ +import org.apache.spark.sql.execution.adaptive.DisableAdaptiveExecutionSuite +import org.apache.spark.sql.execution.exchange.{Exchange, ReusedExchangeExec} +import org.apache.spark.sql.internal.SQLConf + +/** + * Check that TPCDS SparkPlans don't change. + * If there are plan differences, the error message looks like this: + * Plans did not match: + * last approved plan: /path/to/tpcds-plan-stability/approved-plans-xxx/q1/simplified.txt + * last explain: /path/to/tpcds-plan-stability/approved-plans-xxx/q1/explain.txt + * actual plan: /path/to/tmp/q1.actual.simplified.txt + * actual explain: /path/to/tmp/q1.actual.explain.txt + * [side by side plan diff] + * The explain files are saved to help debug later, they are not checked. Only the simplified + * plans are checked (by string comparison). + * + * Approving new plans: + * IF the plan change is intended then re-running the test + * with environ var SPARK_GENERATE_GOLDEN_FILES=1 will make the new plan canon. + * This should be done only for the queries that need it, to avoid unnecessary diffs in the + * other approved plans. + * This can be done by running sbt test-only *PlanStability[WithStats]Suite* -- -z "q31" + * The new plan files should be part of the PR and reviewed. + */ +trait PlanStabilitySuite extends TPCDSBase with DisableAdaptiveExecutionSuite { Review comment: Oh, I see. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org