Skip to content
Closed
Show file tree
Hide file tree
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
Prev Previous commit
Next Next commit
fix compile
  • Loading branch information
dtenedor committed Mar 16, 2023
commit dd2c28e6eca3afc76a76cb2b3cc6d9d0288c0df5
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class ExpressionsSchemaSuite extends QueryTest with SharedSparkSession {
private val resultFile = new File(baseResourcePath, "sql-expression-schema.md")

/** A single SQL query's SQL and schema. */
protected case class ExpressionSQLOutput(
protected case class QueryOutput(
className: String,
funcName: String,
sql: String = "N/A",
Expand All @@ -96,7 +96,7 @@ class ExpressionsSchemaSuite extends QueryTest with SharedSparkSession {
case (className, infos) => (className, infos.sortBy(_.getName))
}
val outputBuffer = new ArrayBuffer[String]
val outputs = new ArrayBuffer[ExpressionSQLOutput]
val outputs = new ArrayBuffer[QueryOutput]
val missingExamples = new ArrayBuffer[String]

classFunsMap.foreach { kv =>
Expand All @@ -105,7 +105,7 @@ class ExpressionsSchemaSuite extends QueryTest with SharedSparkSession {
val example = funInfo.getExamples
val funcName = funInfo.getName.replaceAll("\\|", "|")
if (example == "") {
val queryOutput = ExpressionSQLOutput(className, funcName)
val queryOutput = QueryOutput(className, funcName)
outputBuffer += queryOutput.toString
outputs += queryOutput
missingExamples += funcName
Expand All @@ -121,7 +121,7 @@ class ExpressionsSchemaSuite extends QueryTest with SharedSparkSession {
val df = spark.sql(sql)
val escapedSql = sql.replaceAll("\\|", "|")
val schema = df.schema.catalogString.replaceAll("\\|", "|")
val queryOutput = ExpressionSQLOutput(className, funcName, escapedSql, schema)
val queryOutput = QueryOutput(className, funcName, escapedSql, schema)
outputBuffer += queryOutput.toString
outputs += queryOutput
case _ =>
Expand Down Expand Up @@ -167,7 +167,7 @@ class ExpressionsSchemaSuite extends QueryTest with SharedSparkSession {

Seq.tabulate(outputSize) { i =>
val segments = lines(i + headerSize).split('|')
ExpressionSQLOutput(
QueryOutput(
className = segments(1).trim,
funcName = segments(2).trim,
sql = segments(3).trim,
Expand Down
12 changes: 6 additions & 6 deletions sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ abstract class QueryTest extends PlanTest {
}

/** A single SQL query's output. */
protected trait QueryOutput {
protected trait QueryTestOutput {
def sql: String
def schema: Option[String]
def output: String
Expand All @@ -242,7 +242,7 @@ abstract class QueryTest extends PlanTest {
protected case class ExecutionOutput(
sql: String,
schema: Option[String],
output: String) extends QueryOutput {
output: String) extends QueryTestOutput {
override def toString: String = {
// We are explicitly not using multi-line string due to stripMargin removing "|" in output.
s"-- !query\n" +
Expand All @@ -259,7 +259,7 @@ abstract class QueryTest extends PlanTest {
protected case class AnalyzerOutput(
sql: String,
schema: Option[String],
output: String) extends QueryOutput {
output: String) extends QueryTestOutput {
override def toString: String = {
// We are explicitly not using multi-line string due to stripMargin removing "|" in output.
s"-- !query\n" +
Expand All @@ -276,10 +276,10 @@ abstract class QueryTest extends PlanTest {
*/
def readGoldenFileAndCompareResults(
resultFile: String,
outputs: Seq[QueryOutput],
makeOutput: (String, Option[String], String) => QueryOutput): Unit = {
outputs: Seq[QueryTestOutput],
makeOutput: (String, Option[String], String) => QueryTestOutput): Unit = {
// Read back the golden file.
val expectedOutputs: Seq[QueryOutput] = {
val expectedOutputs: Seq[QueryTestOutput] = {
val goldenOutput = fileToString(new File(resultFile))
val segments = goldenOutput.split("-- !query.*\n")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ trait SQLQueryTestHelper extends Logging {
for (c <- allCode) {
if (c.trim.startsWith("--QUERY-DELIMITER-START")) {
start = true
queries ++= splitWithSemicolon(otherCodes)
queries ++= splitWithSemicolon(otherCodes.toSeq)
otherCodes.clear()
} else if (c.trim.startsWith("--QUERY-DELIMITER-END")) {
start = false
Expand All @@ -183,11 +183,11 @@ trait SQLQueryTestHelper extends Logging {
}
}
if (otherCodes.nonEmpty) {
queries ++= splitWithSemicolon(otherCodes)
queries ++= splitWithSemicolon(otherCodes.toSeq)
}
queries
} else {
splitWithSemicolon(allCode).toSeq
splitWithSemicolon(allCode.toSeq).toSeq
}

// List of SQL queries to run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession with SQLHelper
conf

// Run the SQL queries preparing them for comparison.
val outputs: Seq[QueryOutput] = queries.map { sql =>
val outputs: Seq[QueryTestOutput] = queries.map { sql =>
testCase match {
case _: AnalyzerTest =>
val (_, output) =
Expand Down