Skip to content
Closed
Changes from 1 commit
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 @@ -595,7 +595,6 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession with SQLHelper
file.getAbsolutePath.replace(inputFilePath, analyzerGoldenFilePath) + ".out"
val absPath = file.getAbsolutePath
val testCaseName = absPath.stripPrefix(inputFilePath).stripPrefix(File.separator)
val analyzerTestCaseName = s"${testCaseName}_analyzer_test"

// Create test cases of test types that depend on the input filename.
val newTestCases: Seq[TestCase] = if (file.getAbsolutePath.startsWith(
Expand Down Expand Up @@ -838,13 +837,17 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession with SQLHelper
s"Schema did not match for query #$i\n${expected.sql}: $output") {
output.schema
}
assertResult(expected.output, s"Result did not match" +
assertResult(normalizeOwner(expected.output), s"Result did not match" +
s" for query #$i\n${expected.sql}") {
output.output
}
}
}

private def normalizeOwner(plan: String): String = {
plan.replaceAll("""Owner\t\{runner}""", "Owner\t" + Utils.getCurrentUserName)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this work is OK. But it introduce the extra complexity and readability.


/** A single SQL query's output. */
trait QueryTestOutput {
def sql: String
Expand Down