[
https://issues.apache.org/jira/browse/SPARK-31210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17063849#comment-17063849
]
jiaan.geng commented on SPARK-31210:
------------------------------------
The content of /home/test/test_table_like.json show below:
{code:java}
{"subject":"100 times"}
{"subject":"1000 times"}
{"subject":"100%"}
{code}
I follow your example and run it
{code:java}
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 3.1.0-SNAPSHOT
/_/
Using Scala version 2.12.10 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60)
Type in expressions to have them evaluated.
Type :help for more information.
scala> val path = "/home/test/test_table_like.json"
path: String = /home/test/test_table_like.json
scala> val tmpdf = spark.read.json(path)
20/03/21 18:33:56 ERROR LzoCodec: Failed to load/initialize native-lzo library
tmpdf: org.apache.spark.sql.DataFrame = [subject: string]
scala> tmpdf.createOrReplaceTempView("test_table_like")
scala> spark.sql("select * from test_table_like where subject like '100%' order
by 1")
res1: org.apache.spark.sql.DataFrame = [subject: string]
scala> res1.show()
+----------+
| subject|
+----------+
| 100 times|
| 100%|
|1000 times|
+----------+
{code}
> An issue for Spark SQL LIKE-with-ESCAPE clause
> ----------------------------------------------
>
> Key: SPARK-31210
> URL: https://issues.apache.org/jira/browse/SPARK-31210
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.0.0
> Reporter: Mingli Rui
> Priority: Major
>
> I try to use LIKE with ESCAPE for Spark 3.0.0-preview2. But I find in it
> doesn't work in below cases.
> The database table
> ==============
> create or replace table test_table_like ( subject string)
> insert into $test_table_like values ('100 times'), ('1000 times'), ('100%')
>
> Repro
> ====
> val result2 = sparkSession.sql(
> s"select * from test_table_like where subject like '100^%' escape '^' order
> by 1")
> "100%" is expected to returned, but it doesn't. I debug into the code to
> check the logical plan.
> In the logical plan, the LIKE is transformed as "StartsWith(subject#130,
> 100^)". It looks it is incorrect.
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]