Skip to content

Commit

Permalink
[SPARK-47911][SQL][FOLLOWUP] Enable binary format tests in ThriftServ…
Browse files Browse the repository at this point in the history
…erQueryTestSuite

### What changes were proposed in this pull request?

This PR enables binary format tests in ThriftServerQueryTestSuite

### Why are the changes needed?

improve test coverage
### Does this PR introduce _any_ user-facing change?

no

### How was this patch tested?

new tests
### Was this patch authored or co-authored using generative AI tooling?

no

Closes #47028 from yaooqinn/SPARK-47911-F.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
  • Loading branch information
yaooqinn committed Jun 20, 2024
1 parent 955349f commit 714699b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sql/core/src/test/resources/sql-tests/inputs/binary.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--SET spark.sql.binaryOutputStyle=UTF8;
--SET spark.sql.binaryOutputStyle=UTF8

SELECT X'';
SELECT X'4561736F6E2059616F20323031382D31312D31373A31333A33333A3333';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--IMPORT binary.sql

--SET spark.sql.binaryOutputStyle=BASE64;
--SET spark.sql.binaryOutputStyle=BASE64
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--IMPORT binary.sql

--SET spark.sql.binaryOutputStyle=BASIC;
--SET spark.sql.binaryOutputStyle=BASIC

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--IMPORT binary.sql

--SET spark.sql.binaryOutputStyle=HEX;
--SET spark.sql.binaryOutputStyle=HEX
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
--IMPORT binary.sql

--SET spark.sql.binaryOutputStyle=HEX_DISCRETE;
--SET spark.sql.binaryOutputStyle=HEX_DISCRETE
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite with SharedThriftServ
// SPARK-42921
"timestampNTZ/datetime-special-ansi.sql",
// SPARK-47264
"collations.sql",
"binary_hex.sql",
"binary_hex_discrete.sql",
"binary_basic.sql",
"binary_base64.sql"
"collations.sql"
)

override def runQueries(
Expand Down Expand Up @@ -135,13 +131,15 @@ class ThriftServerQueryTestSuite extends SQLQueryTestSuite with SharedThriftServ
}

// Run the SQL queries preparing them for comparison.
val outputs: Seq[QueryTestOutput] = queries.map { sql =>
val (_, output) = handleExceptions(getNormalizedResult(statement, sql))
// We might need to do some query canonicalization in the future.
ExecutionOutput(
sql = sql,
schema = Some(""),
output = output.mkString("\n").replaceAll("\\s+$", ""))
val outputs: Seq[QueryTestOutput] = withSQLConf(configSet: _*) {
queries.map { sql =>
val (_, output) = handleExceptions(getNormalizedResult(statement, sql))
// We might need to do some query canonicalization in the future.
ExecutionOutput(
sql = sql,
schema = Some(""),
output = output.mkString("\n").replaceAll("\\s+$", ""))
}
}

// Read back the golden file.
Expand Down

0 comments on commit 714699b

Please sign in to comment.