This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 509f93617c01 [SPARK-52530][SQL][TESTS] Move `SimpleTestOptimizer` to
test source directory
509f93617c01 is described below
commit 509f93617c01ca3b08da4c1b11e973c3979b376a
Author: yangjie01 <[email protected]>
AuthorDate: Fri Jun 20 07:58:35 2025 -0700
[SPARK-52530][SQL][TESTS] Move `SimpleTestOptimizer` to test source
directory
### What changes were proposed in this pull request?
This pr moves `SimpleTestOptimizer` to the test source code directory since
it is only used for testing purposes.
### Why are the changes needed?
Place the code that is exclusively used for testing into the test source
code directory.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
- Pass GitHub Actions
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #51222 from LuciferYang/Move-SimpleTestOptimizer-2-TestDir.
Lead-authored-by: yangjie01 <[email protected]>
Co-authored-by: YangJie <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../spark/sql/catalyst/optimizer/Optimizer.scala | 14 ---------
.../catalyst/optimizer/SimpleTestOptimizer.scala | 34 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
index 8236fee4bcb9..2701a79077ce 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
@@ -23,7 +23,6 @@ import org.apache.spark.SparkException
import org.apache.spark.internal.{LogKeys, MDC}
import org.apache.spark.sql.catalyst.SQLConfHelper
import org.apache.spark.sql.catalyst.analysis._
-import org.apache.spark.sql.catalyst.catalog.{InMemoryCatalog, SessionCatalog}
import org.apache.spark.sql.catalyst.expressions._
import
org.apache.spark.sql.catalyst.expressions.SubqueryExpression.hasCorrelatedSubquery
import org.apache.spark.sql.catalyst.expressions.aggregate._
@@ -573,19 +572,6 @@ object EliminateAggregateFilter extends Rule[LogicalPlan] {
}
}
-/**
- * An optimizer used in test code.
- *
- * To ensure extendability, we leave the standard rules in the abstract
optimizer rules, while
- * specific rules go to the subclasses
- */
-object SimpleTestOptimizer extends SimpleTestOptimizer
-
-class SimpleTestOptimizer extends Optimizer(
- new CatalogManager(
- FakeV2SessionCatalog,
- new SessionCatalog(new InMemoryCatalog, EmptyFunctionRegistry,
EmptyTableFunctionRegistry)))
-
/**
* Remove redundant aliases from a query plan. A redundant alias is an alias
that does not change
* the name or metadata of a column, and does not deduplicate it.
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimpleTestOptimizer.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimpleTestOptimizer.scala
new file mode 100644
index 000000000000..007a2b3fd058
--- /dev/null
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimpleTestOptimizer.scala
@@ -0,0 +1,34 @@
+/*
+ * 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.catalyst.optimizer
+
+import org.apache.spark.sql.catalyst.analysis.{EmptyFunctionRegistry,
EmptyTableFunctionRegistry, FakeV2SessionCatalog}
+import org.apache.spark.sql.catalyst.catalog.{InMemoryCatalog, SessionCatalog}
+import org.apache.spark.sql.connector.catalog.CatalogManager
+
+/**
+ * An optimizer used in test code.
+ *
+ * To ensure extendability, we leave the standard rules in the abstract
optimizer rules, while
+ * specific rules go to the subclasses
+ */
+object SimpleTestOptimizer extends SimpleTestOptimizer
+
+class SimpleTestOptimizer extends Optimizer(
+ new CatalogManager(
+ FakeV2SessionCatalog,
+ new SessionCatalog(new InMemoryCatalog, EmptyFunctionRegistry,
EmptyTableFunctionRegistry)))
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]