'ilike' 关键字不适用于 spark SQL

'ilike' keyword not working with spark SQL

我正在学习 apache-spark。令人困惑的是,

这个命令有效

results = spark.sql("select * from df_sql_view where name LIKE '%i%'")

但这会引发错误

results = spark.sql("select * from df_sql_view where name ILIKE '%i%'")

ParseException: 
mismatched input 'ILIKE' expecting {<EOF>, ';'}(line 1, pos 37)

== SQL ==
select * from df_sql_view where name ILIKE '%i%'
-------------------------------------^^^

有人可以帮我理解为什么以及如何解决它。谢谢。

Spark SQL 仅支持 like and rlike。所以你想使用 rlike 和适当的正则表达式来替换 ilike