Skip to content

Commit

Permalink
scalafmtAll
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Apr 10, 2024
1 parent 026b362 commit 38a7bbb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ object FlintJob extends Logging with FlintJobExecutor {
conf.set(FlintSparkConf.JOB_TYPE.key, jobType)

val dataSource = conf.get("spark.flint.datasource.name", "")
val query = queryOption.getOrElse(
unescapeQuery(conf.get(FlintSparkConf.QUERY.key, "")))
val query = queryOption.getOrElse(unescapeQuery(conf.get(FlintSparkConf.QUERY.key, "")))
if (query.isEmpty) {
throw new IllegalArgumentException(s"Query undefined for the ${jobType} job.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ trait FlintJobExecutor {
}

/**
* Unescape the query string which is escaped for EMR spark submit parameter parsing.
* Ref: https://github.com/opensearch-project/sql/pull/2587
* Unescape the query string which is escaped for EMR spark submit parameter parsing. Ref:
* https://github.com/opensearch-project/sql/pull/2587
*/
def unescapeQuery(query: String): String = {
unescapeJava(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ class FlintREPLTest
query shouldBe "SELECT * FROM table"
}

test("getQuery should return unescaped default query for streaming job if queryOption is None") {
test(
"getQuery should return unescaped default query for streaming job if queryOption is None") {
val queryOption = None
val jobType = "streaming"
val conf = new SparkConf().set(
FlintSparkConf.QUERY.key, "SELECT \\\"1\\\" UNION SELECT '\\\"1\\\"' UNION SELECT \\\"\\\\\\\"1\\\\\\\"\\\"")
FlintSparkConf.QUERY.key,
"SELECT \\\"1\\\" UNION SELECT '\\\"1\\\"' UNION SELECT \\\"\\\\\\\"1\\\\\\\"\\\"")

val query = FlintREPL.getQuery(queryOption, jobType, conf)
query shouldBe "SELECT \"1\" UNION SELECT '\"1\"' UNION SELECT \"\\\"1\\\"\""
Expand Down

0 comments on commit 38a7bbb

Please sign in to comment.