Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UT adjust override checkScanSchemata & enabling ut of exclude_by_suffix fea. #11520

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,33 @@
spark-rapids-shim-json-lines ***/
package org.apache.spark.sql.rapids.suites

import org.apache.spark.sql.DataFrame
import org.apache.spark.sql.catalyst.parser.CatalystSqlParser
import org.apache.spark.sql.execution.FileSourceScanExec
import org.apache.spark.sql.execution.datasources.parquet.ParquetSchemaPruningSuite
import org.apache.spark.sql.rapids.GpuFileSourceScanExec
import org.apache.spark.sql.rapids.utils.RapidsSQLTestsBaseTrait

class RapidsParquetSchemaPruningSuite
extends ParquetSchemaPruningSuite
with RapidsSQLTestsBaseTrait {}
with RapidsSQLTestsBaseTrait {

override protected def checkScanSchemata(df: DataFrame,
expectedSchemaCatalogStrings: String*): Unit = {
val fileSourceScanSchemata =
collect(df.queryExecution.executedPlan) {
case scan: FileSourceScanExec => scan.requiredSchema
case gpuScan: GpuFileSourceScanExec => gpuScan.requiredSchema
}
assert(fileSourceScanSchemata.size === expectedSchemaCatalogStrings.size,
s"Found ${fileSourceScanSchemata.size} file sources in dataframe, " +
s"but expected $expectedSchemaCatalogStrings")
fileSourceScanSchemata.zip(expectedSchemaCatalogStrings).foreach {
case (scanSchema, expectedScanSchemaCatalogString) =>
val expectedScanSchema = CatalystSqlParser.parseDataType(expectedScanSchemaCatalogString)
implicit val equality = schemaEquality
assert(scanSchema === expectedScanSchema)
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ abstract class BackendTestSettings {
this
}

def excludeBySuffix(suffixes: String, reason: ExcludeReason): SuiteSettings = {
exclusion.add(ExcludeBySuffix(suffixes))
excludeReasons.add(reason)
this
}

def includeRapidsTestsByPrefix(prefixes: String*): SuiteSettings = {
inclusion.add(IncludeRapidsTestByPrefix(prefixes: _*))
this
Expand All @@ -152,13 +158,20 @@ abstract class BackendTestSettings {
this
}

def excludeRapidsTestsBySuffix(suffixes: String, reason: ExcludeReason): SuiteSettings = {
exclusion.add(ExcludeRadpisTestByPrefix(suffixes))
excludeReasons.add(reason)
this
}

def includeAllRapidsTests(): SuiteSettings = {
inclusion.add(IncludeByPrefix(RAPIDS_TEST))
this
}

def excludeAllRapidsTests(reason: ExcludeReason): SuiteSettings = {
exclusion.add(ExcludeByPrefix(RAPIDS_TEST))
exclusion.add(ExcludeBySuffix(RAPIDS_TEST))
excludeReasons.add(reason)
this
}
Expand Down Expand Up @@ -210,6 +223,15 @@ abstract class BackendTestSettings {
}
}

private case class ExcludeBySuffix(suffixes: String*) extends ExcludeBase {
override def isExcluded(testName: String): Boolean = {
if (suffixes.exists(suffix => testName.endsWith(suffix))) {
return true
}
false
}
}

private case class IncludeRapidsTestByPrefix(prefixes: String*) extends IncludeBase {
override def isIncluded(testName: String): Boolean = {
if (prefixes.exists(prefix => testName.startsWith(RAPIDS_TEST + prefix))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ class RapidsTestSettings extends BackendTestSettings {
.exclude("SPARK-31159: rebasing dates in write", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11404"))
.exclude("SPARK-35427: datetime rebasing in the EXCEPTION mode", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11404"))
enableSuite[RapidsParquetSchemaPruningSuite]
.excludeByPrefix("Spark vectorized reader", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11405"))
.excludeByPrefix("Non-vectorized reader", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11405"))
.excludeByPrefix("Case-insensitive parser", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11405"))
.excludeByPrefix("Case-sensitive parser", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11405"))
.excludeBySuffix("select a single complex field", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11619"))
.excludeBySuffix("select a single complex field and the partition column", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11620"))
.excludeBySuffix("select missing subfield", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11621"))
.excludeBySuffix("select explode of nested field of array of struct", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11653"))
.excludeBySuffix("empty schema intersection", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11627"))
.excludeBySuffix("select one deep nested complex field after join", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11628"))
.excludeBySuffix("select one deep nested complex field after outer join", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11629"))
enableSuite[RapidsParquetSchemaSuite]
.exclude("schema mismatch failure error message for parquet reader", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11434"))
.exclude("schema mismatch failure error message for parquet vectorized reader", KNOWN_ISSUE("https://github.com/NVIDIA/spark-rapids/issues/11446"))
Expand Down