MaxGekk opened a new pull request #27355: [SPARK-30625][SQL] Support `escape` 
as third parameter of the `like` function
URL: https://github.com/apache/spark/pull/27355
 
 
   ### What changes were proposed in this pull request?
   In the PR, I propose to transform the `Like` expression to 
`TernaryExpression`, and add third parameter `escape`. So, the `like` function 
will have feature parity with `LIKE ... ESCAPE` syntax supported by 
https://github.com/apache/spark/commit/187f3c17733f94aa3372caca355ad18ec1198f2f.
   
   ### Why are the changes needed?
   The `like` functions can be called with 2 or 3 parameters, and functionally 
equivalent to `LIKE` and `LIKE ... ESCAPE` SQL expressions.
   
   ### Does this PR introduce any user-facing change?
   Yes, before `like` fails with the exception:
   ```sql
   spark-sql> SELECT like('_Apache Spark_', '__%Spark__', '_');
   Error in query: Invalid number of arguments for function like. Expected: 2; 
Found: 3; line 1 pos 7
   ```
   After:
   ```sql
   spark-sql> SELECT like('_Apache Spark_', '__%Spark__', '_');
   true
   ```
   
   ### How was this patch tested?
   - Add new example for the `like` function which is checked by `SQLQuerySuite`
   - Run `RegexpExpressionsSuite` and `ExpressionParserSuite`.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to