LuciferYang commented on code in PR #12840:
URL: https://github.com/apache/gluten/pull/12840#discussion_r3834817441


##########
gluten-ut/spark34/src/test/scala/org/apache/spark/sql/GlutenImplicitsTest.scala:
##########
@@ -0,0 +1,134 @@
+/*
+ * 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.apache.gluten.config.GlutenConfig
+
+import org.apache.spark.SparkConf
+import org.apache.spark.sql.execution.GlutenImplicits._
+import org.apache.spark.sql.internal.SQLConf
+
+class GlutenImplicitsTest extends GlutenSQLTestsBaseTrait {

Review Comment:
   You were right and I was not. Let me correct the record.
   
   The part of my answer about the mechanism holds: 
`BackendTestSettings.instance` reflectively loads `VeloxTestSettings` / 
`ClickHouseTestSettings` (`BackendTestSettings.scala:199-213`), and those only 
exist in the per-version modules, so the settings-based gating genuinely cannot 
live in a version-agnostic module. What I got wrong is the conclusion I drew 
from it. The suite does not have to keep that gating, and `gluten-ut/test` 
already has an idiom for this exact shape: `GlutenSQLRangeExecSuite extends 
GlutenQueryTest with SharedSparkSession` and sets `spark.plugins` in its own 
`sparkConf` (`GlutenSQLRangeExecSuite.scala:27-42`). Four of the eleven suites 
there are built that way, and eight of the eleven already fork on the loaded 
backend.
   
   Both things I called blockers have cheap expressions in that module.
   
   The version difference is one assertion, not a pattern. Diffing the five 
copies with comments and blank lines stripped, the only line that differs is 
`numGlutenNodes == 1` on 3.3 versus `== 0` on 3.4+ for `fallbackSummary with 
data write command`; the other expectations (1, 1, 6, 6, 0, 2, 2, 7, 7) are 
identical everywhere. `GlutenQueryTest.isSparkVersionGE` 
(`gluten-substrait/src/test/scala/org/apache/spark/sql/GlutenQueryTest.scala:57`)
 is already on the candidate base class, so it costs one `if` and no import.
   
   The three cases where ClickHouse reports different counts become 
`assume(BackendTestUtils.isVeloxBackendLoaded())`, following 
`GlutenCheckOverflowTransformerSuite.scala:47`. Coverage does not change: the 
same three cases are skipped on CH before and after. What changes is that the 
reason sits next to the case instead of in a 2000-line settings file. The 
better version of this is to assert CH's own numbers rather than skip, but 
`ClickHouseTestSettings` only ever recorded that they were excluded, never what 
CH actually reports, so that needs a CH run to fill in and I would rather not 
guess node counts.
   
   The session conf carries over as a direct call. 
`GlutenSQLTestsBaseTrait.nativeSparkConf(SparkConf, String)` is a 
companion-object method that touches only `BackendTestUtils` and `GlutenConfig` 
(`GlutenSQLTestsBaseTrait.scala:82-113`), and `gluten-ut/test` has 
compile-scope on gluten-ut-common's test-jar, so the conf is reused rather than 
hand-copied. That matters here because the node counts depend on it.
   
   I will do this in this PR rather than a follow-up, since landing four copies 
and deleting them immediately afterwards is the thing you are objecting to. It 
collapses five copies into one, drops all ten 
`enableSuite[GlutenImplicitsTest]` registrations, and takes about 500 lines off 
the diff. Note that spark33's copy has to go in the same change: `common` and 
`test` are permanent modules (`gluten-ut/pom.xml:32-35`), so the shared suite 
also runs under `-Pspark-3.3` and keeping the old copy would run it twice. No 
case is lost, but the PR stops being a pure addition, and I will reword the 
description accordingly.



-- 
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]

Reply via email to