Skip to content

Commit

Permalink
use temp view in test
Browse files Browse the repository at this point in the history
  • Loading branch information
luluorta committed Dec 8, 2020
1 parent 765591c commit 58b8bd2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3720,16 +3720,16 @@ class SQLQuerySuite extends QueryTest with SharedSparkSession with AdaptiveSpark
}

test("SPARK-33677: LikeSimplification should be skipped if pattern contains any escapeChar") {
withTable("string_tbl") {
sql("CREATE TABLE string_tbl USING parquet SELECT 'm@ca' AS s")
withTempView("df") {
Seq("m@ca").toDF("s").createOrReplaceTempView("df")

val e = intercept[AnalysisException] {
sql("SELECT s LIKE 'm%@ca' ESCAPE '%' FROM string_tbl").collect()
sql("SELECT s LIKE 'm%@ca' ESCAPE '%' FROM df").collect()
}
assert(e.message.contains("the pattern 'm%@ca' is invalid, " +
"the escape character is not allowed to precede '@'"))

checkAnswer(sql("SELECT s LIKE 'm@@ca' ESCAPE '@' FROM string_tbl"), Row(true))
checkAnswer(sql("SELECT s LIKE 'm@@ca' ESCAPE '@' FROM df"), Row(true))
}
}
}
Expand Down

0 comments on commit 58b8bd2

Please sign in to comment.