Copilot commented on code in PR #13115: URL: https://github.com/apache/gluten/pull/13115#discussion_r4283332578
########## backends-velox/src/test/scala/org/apache/spark/sql/execution/joins/GlutenParallelBroadcastJoinSuite.scala: ########## @@ -0,0 +1,67 @@ +/* + * 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.execution.joins + +import org.apache.gluten.execution.{BroadcastHashJoinExecTransformer, VeloxWholeStageTransformerSuite} + +import org.apache.spark.SparkConf +import org.apache.spark.sql.execution.ColumnarBroadcastExchangeExec + +class GlutenParallelBroadcastJoinSuite extends VeloxWholeStageTransformerSuite { + + override protected val resourcePath: String = "placeholder" Review Comment: Using a literal value like `\"placeholder\"` for `resourcePath` is unclear and can make failures harder to diagnose if the base suite expects a real resource directory. Either set this to a meaningful existing resource path used elsewhere in the test suite, or add a brief comment explaining why it’s safe/required for this suite (or avoid overriding it if the base default is acceptable). ########## cpp/velox/compute/VeloxBackend.cc: ########## @@ -254,6 +255,10 @@ void VeloxBackend::init( std::make_unique<folly::CPUThreadPoolExecutor>(ioThreads, folly::CPUThreadPoolExecutor::makeLifoSemQueue()); } + const auto broadcastHashTableBuildThreads = + std::max<int32_t>(1, backendConf_->get<int32_t>(kBroadcastHashTableBuildThreads, numTaskSlotsPerExecutor)); Review Comment: This unconditionally creates an additional CPU thread pool sized (by default) to the executor task slots. That can significantly increase the total thread count per executor (on top of existing IO/spill/cache pools) and lead to CPU oversubscription. Consider either (a) lazy-creating the executor only when parallel join build is enabled/used, or (b) defaulting to a smaller value (e.g., 1) unless explicitly configured, while keeping the min(1, …) safety. ########## cpp/velox/tests/VeloxBackendTest.cc: ########## @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#include <folly/executors/CPUThreadPoolExecutor.h> +#include <folly/futures/Future.h> +#include <gtest/gtest.h> +#include <thread> + +#include "compute/VeloxBackend.h" +#include "config/VeloxConfig.h" + +namespace gluten { + +class VeloxBackendTest : public ::testing::Test { + protected: + static void SetUpTestSuite() { + VeloxBackend::create(AllocationListener::noop(), {{kNumTaskSlotsPerExecutor, "0"}}); + } + + static void TearDownTestSuite() { + VeloxBackend::get()->tearDown(); + } +}; + +TEST_F(VeloxBackendTest, broadcastHashTableBuildExecutorWithZeroTaskSlots) { + auto* backend = VeloxBackend::get(); + auto* executor = dynamic_cast<folly::CPUThreadPoolExecutor*>(backend->broadcastHashTableBuildExecutor()); + ASSERT_NE(executor, nullptr); + ASSERT_EQ(executor->numThreads(), 1); Review Comment: The production API exposes `folly::Executor*`, but the test relies on `dynamic_cast<folly::CPUThreadPoolExecutor*>` to validate thread count. This tightly couples tests (and potentially future callers) to the concrete executor type. Prefer exposing a `folly::ThreadPoolExecutor*` (if thread-count introspection is needed) or add a small VeloxBackend accessor for the configured thread count so tests can validate behavior without downcasting to a specific executor implementation. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
