rdtr opened a new pull request, #13577:
URL: https://github.com/apache/gluten/pull/13577

   ## What changes are proposed in this pull request?
   
   Fixes #13576.
   
   Spark accepts any single character as the `LIKE` / `ILIKE` escape, so `s 
LIKE 'aé%_b' ESCAPE 'é'` works on vanilla Spark. Gluten offloads it and the 
task fails with `VeloxUserError ... Reason: (2 vs. 1) Escape string must be a 
single character`. `genLikeTransformer` passes the escape as a one-character 
string, and Velox `like` needs it to be one byte. Velox decided not to support 
multi-byte escape characters (facebookincubator/velox#8363, docs in 
facebookincubator/velox#9062). Its `makeLike` returns an always-failing 
function instead of throwing, so plan validation did not catch it.
   
   `VeloxSparkPlanExecApi.genLikeTransformer` now throws 
`GlutenNotSupportException` when the escape character is above `0x7f`. The 
project or filter falls back to Spark. ASCII escape characters, including the 
default `\`, are offloaded as before. `ILIKE` is rewritten to 
`Like(Lower(left), Lower(right), escapeChar)` before planning and goes through 
the same path. `LIKE ANY` / `LIKE ALL` take no `ESCAPE` clause and are not 
affected.
   
   ## How was this patch tested?
   
   `VeloxStringFunctionsSuite` has a new test `like and ilike with escape 
character` on a Parquet table. `LIKE` and `ILIKE` with the ASCII escape `#` 
stay offloaded (`ProjectExecTransformer`). `LIKE` and `ILIKE` with `é` in a 
projection, and `LIKE` with `é` in a filter, fall back (`ProjectExec`, 
`FilterExec`). All results match vanilla Spark. The patterns include an 
unescaped `_`, so `LikeSimplification` leaves the `Like` in the plan.
   
   The suite passes on Spark 4.1 (46 succeeded) and Spark 3.5 (47 succeeded), 
run with `SPARK_ANSI_SQL_MODE=false SPARK_TESTING=true` and scalastyle and 
spotless on. With the new check removed, the test fails with the `Escape string 
must be a single character` error above.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to