leanken commented on a change in pull request #29104:
URL: https://github.com/apache/spark/pull/29104#discussion_r456728332



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/NotInSubqueryHashJoinTestSuite.scala
##########
@@ -0,0 +1,64 @@
+/*
+ * 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 java.io.File
+
+import org.apache.spark.SparkConf
+import org.apache.spark.sql.internal.SQLConf
+
+/**
+ * End-to-end test cases for subquery SQL queries coverage with
+ * NOT_IN_SUBQUERY_HASH_JOIN_ENABLED = true.
+ *
+ * Each case is loaded from a file in
+ * "spark/sql/core/src/test/resources/sql-tests/inputs/subquery".
+ * Each case has a golden result file in
+ * "spark/sql/core/src/test/resources/sql-tests/results/subquery".
+ *
+ * To run the entire test suite:
+ * {{{
+ *   build/sbt "sql/test-only *NotInSubqueryHashJoinTestSuite"
+ * }}}
+ *
+ */
+class NotInSubqueryHashJoinTestSuite extends SQLQueryTestSuite {
+
+  protected override def sparkConf: SparkConf = super.sparkConf
+    // Fewer shuffle partitions to speed up testing.
+    // enable NOT_IN_SUBQUERY_HASH_JOIN_ENABLED for subquery case coverage.
+    .set(SQLConf.SHUFFLE_PARTITIONS, 4)
+    .set(SQLConf.NOT_IN_SUBQUERY_HASH_JOIN_ENABLED, true)
+
+  override lazy val listTestCases: Seq[TestCase] = {

Review comment:
       > This approach of running all .sql.out tests that match a certain file 
pattern (subquery) with a config is neat but I wonder if it is a bit brittle -- 
but maybe these new files are added rarely so this may be ok. I am not sure if 
there is precedence here.
   
   yes, there is a  precedence. See. 
   org.apache.spark.sql.hive.thriftserver.ThriftServerQueryTestSuite
   
   ThriftServerQueryTestSuite also extended SQLQueryTestSuite but only update 
ignoreList
   ```
   class ThriftServerQueryTestSuite extends SQLQueryTestSuite with 
SharedThriftServer {
   
   
     override def mode: ServerMode.Value = ServerMode.binary
   
     override protected def testFile(fileName: String): String = {
       val url = 
Thread.currentThread().getContextClassLoader.getResource(fileName)
       // Copy to avoid URISyntaxException during accessing the resources in 
`sql/core`
       val file = File.createTempFile("thriftserver-test", ".data")
       file.deleteOnExit()
       FileUtils.copyURLToFile(url, file)
       file.getAbsolutePath
     }
   
     /** List of test cases to ignore, in lower cases. */
     override def ignoreList: Set[String] = super.ignoreList ++ Set(
       // Missing UDF
       "postgreSQL/boolean.sql",
       "postgreSQL/case.sql",
       // SPARK-28624
       "date.sql",
       // SPARK-28620
       "postgreSQL/float4.sql",
   ```




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

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