From 9e517ef48ab7b11d2239faade5c56643ac935ba6 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Fri, 30 Aug 2024 13:52:09 -0600 Subject: [PATCH] chore: Disable shuffle by default and add unit test to prevent config regressions (#414) * Set internal default configs * add header * comment out shuffle mode check * revert shuffle mode default change * revert enable shuffle by default * update defaults --- .../scala/org/apache/comet/CometConf.scala | 2 +- .../comet/AppleDefaultConfigSuite.scala | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 spark/src/test/scala/org/apache/comet/AppleDefaultConfigSuite.scala diff --git a/common/src/main/scala/org/apache/comet/CometConf.scala b/common/src/main/scala/org/apache/comet/CometConf.scala index a44253a77..5683db687 100644 --- a/common/src/main/scala/org/apache/comet/CometConf.scala +++ b/common/src/main/scala/org/apache/comet/CometConf.scala @@ -189,7 +189,7 @@ object CometConf extends ShimCometConf { "'spark.shuffle.manager' must be set before starting the Spark application and " + "cannot be changed during the application.") .booleanConf - .createWithDefault(true) + .createWithDefault(false) val COMET_SHUFFLE_MODE: ConfigEntry[String] = conf(s"$COMET_EXEC_CONFIG_PREFIX.shuffle.mode") .doc("The mode of Comet shuffle. This config is only effective if Comet shuffle " + diff --git a/spark/src/test/scala/org/apache/comet/AppleDefaultConfigSuite.scala b/spark/src/test/scala/org/apache/comet/AppleDefaultConfigSuite.scala new file mode 100644 index 000000000..71846200d --- /dev/null +++ b/spark/src/test/scala/org/apache/comet/AppleDefaultConfigSuite.scala @@ -0,0 +1,59 @@ +/* + * 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.comet + +import org.apache.spark.sql.CometTestBase + +class AppleDefaultConfigSuite extends CometTestBase { + + test("Comet configuration defaults are as expected") { + // check that we haven't accidentally changed any defaults when we merge changes from OSS Comet + + // scans should be enabled by default + assert(CometConf.COMET_NATIVE_SCAN_ENABLED.defaultValue.get) + + // execs should be disabled by default and users can opt in to try out Comet + // we will enable by default once all memory and performance issues are resolved + assert(!CometConf.COMET_EXEC_ENABLED.defaultValue.get) + + // individual execs all default to enabled + assert(CometConf.COMET_EXEC_AGGREGATE_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_BROADCAST_EXCHANGE_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_BROADCAST_HASH_JOIN_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_COALESCE_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_COLLECT_LIMIT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_EXPAND_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_FILTER_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_GLOBAL_LIMIT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_HASH_JOIN_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_LOCAL_LIMIT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_PROJECT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_SORT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_SORT_MERGE_JOIN_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_TAKE_ORDERED_AND_PROJECT_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_UNION_ENABLED.defaultValue.get) + assert(CometConf.COMET_EXEC_WINDOW_ENABLED.defaultValue.get) + + // shuffle is disabled by default + assert(!CometConf.COMET_EXEC_SHUFFLE_ENABLED.defaultValue.get) + assert("auto" == CometConf.COMET_SHUFFLE_MODE.defaultValue.get) + } + +}