From 48fd51c9edcf2205b4537b3f34dfd3aad7555e4d Mon Sep 17 00:00:00 2001 From: "Ma, Rong" Date: Mon, 20 Nov 2023 18:41:34 +0800 Subject: [PATCH] fix up --- .../backendsapi/clickhouse/CHTestApi.scala | 3 --- .../glutenproject/backendsapi/velox/TestApiImpl.scala | 3 --- .../scala/io/glutenproject/backendsapi/TestApi.scala | 2 -- .../src/test/resources/sql-tests/inputs/group-by.sql | 0 .../resources/sql-tests/inputs/udf/udf-group-by.sql | 0 .../test/resources/sql-tests/results/group-by.sql.out | 0 .../sql-tests/results/udf/udf-group-by.sql.out | 0 .../org/apache/spark/sql/GlutenSQLQueryTestSuite.scala | 10 ++++++---- 8 files changed, 6 insertions(+), 12 deletions(-) rename {backends-velox => gluten-ut/spark32}/src/test/resources/sql-tests/inputs/group-by.sql (100%) rename {backends-velox => gluten-ut/spark32}/src/test/resources/sql-tests/inputs/udf/udf-group-by.sql (100%) rename {backends-velox => gluten-ut/spark32}/src/test/resources/sql-tests/results/group-by.sql.out (100%) rename {backends-velox => gluten-ut/spark32}/src/test/resources/sql-tests/results/udf/udf-group-by.sql.out (100%) diff --git a/backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHTestApi.scala b/backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHTestApi.scala index 2a7a9a4785e3..910eb91bf3b4 100644 --- a/backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHTestApi.scala +++ b/backends-clickhouse/src/main/scala/io/glutenproject/backendsapi/clickhouse/CHTestApi.scala @@ -22,7 +22,4 @@ class CHTestApi extends TestApi { override def getSupportedSQLQueryTests: Set[String] = Set[String]() override def getOverwriteSQLQueryTests: Set[String] = Set[String]() - - override def getOverwriteSQLQueryResourcePath: String = - getClass.getResource("/") + "../../test/resources/resources/sql-tests" } diff --git a/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/TestApiImpl.scala b/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/TestApiImpl.scala index f1ed05cb2819..40f6d8b1a560 100644 --- a/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/TestApiImpl.scala +++ b/backends-velox/src/main/scala/io/glutenproject/backendsapi/velox/TestApiImpl.scala @@ -210,7 +210,4 @@ class TestApiImpl extends TestApi { // Remove corr in udf/udf-group-by.sql "udf/udf-group-by.sql" ) - - override def getOverwriteSQLQueryResourcePath: String = - getClass.getResource("/") + "../../test/resources/resources/sql-tests" } diff --git a/gluten-core/src/main/scala/io/glutenproject/backendsapi/TestApi.scala b/gluten-core/src/main/scala/io/glutenproject/backendsapi/TestApi.scala index 40ef5b25477c..886616704638 100644 --- a/gluten-core/src/main/scala/io/glutenproject/backendsapi/TestApi.scala +++ b/gluten-core/src/main/scala/io/glutenproject/backendsapi/TestApi.scala @@ -20,6 +20,4 @@ trait TestApi { def getSupportedSQLQueryTests: Set[String] def getOverwriteSQLQueryTests: Set[String] - - def getOverwriteSQLQueryResourcePath: String } diff --git a/backends-velox/src/test/resources/sql-tests/inputs/group-by.sql b/gluten-ut/spark32/src/test/resources/sql-tests/inputs/group-by.sql similarity index 100% rename from backends-velox/src/test/resources/sql-tests/inputs/group-by.sql rename to gluten-ut/spark32/src/test/resources/sql-tests/inputs/group-by.sql diff --git a/backends-velox/src/test/resources/sql-tests/inputs/udf/udf-group-by.sql b/gluten-ut/spark32/src/test/resources/sql-tests/inputs/udf/udf-group-by.sql similarity index 100% rename from backends-velox/src/test/resources/sql-tests/inputs/udf/udf-group-by.sql rename to gluten-ut/spark32/src/test/resources/sql-tests/inputs/udf/udf-group-by.sql diff --git a/backends-velox/src/test/resources/sql-tests/results/group-by.sql.out b/gluten-ut/spark32/src/test/resources/sql-tests/results/group-by.sql.out similarity index 100% rename from backends-velox/src/test/resources/sql-tests/results/group-by.sql.out rename to gluten-ut/spark32/src/test/resources/sql-tests/results/group-by.sql.out diff --git a/backends-velox/src/test/resources/sql-tests/results/udf/udf-group-by.sql.out b/gluten-ut/spark32/src/test/resources/sql-tests/results/udf/udf-group-by.sql.out similarity index 100% rename from backends-velox/src/test/resources/sql-tests/results/udf/udf-group-by.sql.out rename to gluten-ut/spark32/src/test/resources/sql-tests/results/udf/udf-group-by.sql.out diff --git a/gluten-ut/spark32/src/test/scala/org/apache/spark/sql/GlutenSQLQueryTestSuite.scala b/gluten-ut/spark32/src/test/scala/org/apache/spark/sql/GlutenSQLQueryTestSuite.scala index 308e3a9e1b19..1a48ad1b381e 100644 --- a/gluten-ut/spark32/src/test/scala/org/apache/spark/sql/GlutenSQLQueryTestSuite.scala +++ b/gluten-ut/spark32/src/test/scala/org/apache/spark/sql/GlutenSQLQueryTestSuite.scala @@ -157,7 +157,7 @@ class GlutenSQLQueryTestSuite protected val testDataPath = new File(resourcesPath, "test-data").getAbsolutePath protected val overwriteResourcePath = - BackendsApiManager.getTestApiInstance.getOverwriteSQLQueryResourcePath + getClass.getResource("/").getPath + "../../../src/test/resources/sql-tests" protected val overwriteInputFilePath = new File(overwriteResourcePath, "inputs").getAbsolutePath protected val overwriteGoldenFilePath = new File(overwriteResourcePath, "results").getAbsolutePath @@ -611,10 +611,12 @@ class GlutenSQLQueryTestSuite } } - listFilesRecursively(new File(inputFilePath)) - .flatMap(createTestCase(_, inputFilePath, goldenFilePath)) ++ listFilesRecursively( - new File(overwriteInputFilePath)) + val overwriteTestCases = listFilesRecursively(new File(overwriteInputFilePath)) .flatMap(createTestCase(_, overwriteInputFilePath, overwriteGoldenFilePath)) + val overwriteTestCaseNames = overwriteTestCases.map(_.name) + listFilesRecursively(new File(inputFilePath)) + .flatMap(createTestCase(_, inputFilePath, goldenFilePath)) + .filterNot(testCase => overwriteTestCaseNames.contains(testCase.name)) ++ overwriteTestCases } /** Returns all the files (not directories) in a directory, recursively. */