rdtr opened a new issue, #13576:
URL: https://github.com/apache/gluten/issues/13576
### Backend
VL (Velox)
### Bug description
### Bug description
**[Expected behavior]** Spark accepts any single character after `ESCAPE` in
`LIKE` and `ILIKE` (`Like.escapeChar` is a `Char`, and the parser only checks
the length). A multi-byte character such as `é` works:
```sql
CREATE TABLE t USING parquet AS SELECT * FROM VALUES ('a%xb'), ('axxb') AS
v(s);
SELECT s, s LIKE 'aé%_b' ESCAPE 'é' FROM t;
-- a%xb true
-- axxb false
```
**[Actual behavior]** With Gluten the query fails:
```
org.apache.gluten.exception.GlutenException: Exception: VeloxUserError
Error Source: USER
Error Code: INVALID_ARGUMENT
Reason: (2 vs. 1) Escape string must be a single character
Retriable: False
Expression: constantEscape->valueAt(0).size() == 1
Function: makeLike
File: ../../velox/functions/lib/Re2Functions.cpp
```
**Cause.** `VeloxSparkPlanExecApi.genLikeTransformer` passes the escape
character to Velox `like` as a one-character string literal. Velox `makeLike`
checks that the escape string is one byte, and `é` is two bytes in UTF-8. The
check does not throw from the factory: it returns an
`AlwaysFailingVectorFunction`, so plan validation passes and the error only
shows up when the task runs. `ILIKE` is rewritten to `Like(Lower(left),
Lower(right), escapeChar)` and fails the same way. `LIKE ANY` / `LIKE ALL` take
no `ESCAPE` clause and are not affected.
Velox decided not to support multi-byte escape characters
(facebookincubator/velox#8363, closed after facebookincubator/velox#9062
documented that the escape must be ASCII). Gluten should fall back when the
escape character is not ASCII.
### Gluten version
main branch
### Spark version
Spark-3.5.x
### Spark configurations
_No response_
### System information
_No response_
### Relevant logs
```bash
```
--
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]