comphead commented on code in PR #3328:
URL: https://github.com/apache/datafusion-comet/pull/3328#discussion_r2742840290


##########
spark/src/test/scala/org/apache/comet/CometSqlFileTestSuite.scala:
##########
@@ -0,0 +1,133 @@
+/*
+ * 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 java.io.File
+
+import org.scalactic.source.Position
+import org.scalatest.Tag
+
+import org.apache.spark.sql.CometTestBase
+import org.apache.spark.sql.execution.adaptive.AdaptiveSparkPlanHelper
+
+class CometSqlFileTestSuite extends CometTestBase with AdaptiveSparkPlanHelper 
{
+
+  override protected def test(testName: String, testTags: Tag*)(testFun: => 
Any)(implicit
+      pos: Position): Unit = {
+    super.test(testName, testTags: _*) {
+      withSQLConf(CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_AUTO) 
{
+        testFun
+      }
+    }
+  }
+
+  /** Check if the current Spark version meets a minimum version requirement. 
*/
+  private def meetsMinSparkVersion(minVersion: String): Boolean = {
+    val current = 
org.apache.spark.SPARK_VERSION.split("[.-]").take(2).map(_.toInt)
+    val required = minVersion.split("[.-]").take(2).map(_.toInt)
+    (current(0) > required(0)) ||
+    (current(0) == required(0) && current(1) >= required(1))
+  }
+
+  private val testResourceDir = {
+    val url = getClass.getClassLoader.getResource("sql-tests")
+    assert(url != null, "Could not find sql-tests resource directory")
+    new File(url.toURI)
+  }
+
+  private def discoverTestFiles(dir: File): Seq[File] = {
+    if (!dir.exists()) return Seq.empty
+    val files = dir.listFiles().toSeq
+    val sqlFiles = files.filter(f => f.isFile && f.getName.endsWith(".sql"))
+    val subDirFiles = files.filter(_.isDirectory).flatMap(discoverTestFiles)
+    sqlFiles ++ subDirFiles
+  }
+
+  /** Generate all config combinations from a ConfigMatrix specification. */
+  private def configCombinations(

Review Comment:
   would it be good to name `configMatrix` ? 



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