HyukjinKwon commented on a change in pull request #31466:
URL: https://github.com/apache/spark/pull/31466#discussion_r571820552



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQueryTestSuite.scala
##########
@@ -566,7 +563,14 @@ class SQLQueryTestSuite extends QueryTest with 
SharedSparkSession with SQLHelper
     // Filter out test files with invalid extensions such as temp files created
     // by vi (.swp), Mac (.DS_Store) etc.
     val filteredFiles = files.filter(_.getName.endsWith(validFileExtensions))
-    filteredFiles ++ dirs.flatMap(listFilesRecursively)
+    val allFiles = filteredFiles ++ dirs.flatMap(listFilesRecursively)
+    // SPARK-32106 Since we add SQL test 'transform.sql' will use `cat` 
command,
+    // here we need to check command available
+    if (TestUtils.testCommandAvailable("/bin/bash")) {
+      allFiles
+    } else {
+      allFiles.filterNot(_.getName == "transform.sql")

Review comment:
       I meant the fix such as:
   
   ```scala
       assume(
         !testCase.inputFile.endsWith("transform.sql") ||
         TestUtils.testCommandAvailable("/bin/bash"))
   ```
   
   I tested that it only skips transform.sql when `/bin/bash` is not available:
   
   ```
   [info] - transform.sql !!! CANCELED !!! (36 milliseconds)
   [info]   
"/.../spark/sql/core/src/test/resources/sql-tests/inputs/transform.sql" ended 
with "transform.sql", and 
org.apache.spark.TestUtils.testCommandAvailable("/bin/bas") was false 
(SQLQueryTestSuite.scala:265)
   [info]   org.scalatest.exceptions.TestCanceledException:
   [info]   at 
org.scalatest.Assertions.newTestCanceledException(Assertions.scala:475)
   [info]   at 
org.scalatest.Assertions.newTestCanceledException$(Assertions.scala:474)
   [info]   at 
org.scalatest.Assertions$.newTestCanceledException(Assertions.scala:1231)
   [info]   at 
org.scalatest.Assertions$AssertionsHelper.macroAssume(Assertions.scala:1310)
   [info]   at 
org.apache.spark.sql.SQLQueryTestSuite.runTest(SQLQueryTestSuite.scala:265)
   [info]   at 
org.apache.spark.sql.SQLQueryTestSuite.$anonfun$createScalaTestCase$5(SQLQueryTestSuite.scala:247)
   [info]   at 
scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
   [info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
   [info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
   [info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
   [info]   at org.scalatest.Transformer.apply(Transformer.scala:22)
   [info]   at org.scalatest.Transformer.apply(Transformer.scala:20)
   [info]   at 
org.scalatest.funsuite.AnyFunSuiteLike$$anon$1.apply(AnyFunSuiteLike.scala:190)
   [info]   at 
org.apache.spark.SparkFunSuite.withFixture(SparkFunSuite.scala:176)
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to