Visorgood commented on code in PR #60564:
URL: https://github.com/apache/spark/pull/60564#discussion_r4617865797
##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/util/V2ExpressionSQLBuilder.java:
##########
@@ -131,9 +132,20 @@ public String build(Expression expr) {
}
case "IS_NULL" -> visitIsNull(visitIsNullOperand(e.children()[0]));
case "IS_NOT_NULL" ->
visitIsNotNull(visitIsNullOperand(e.children()[0]));
- case "STARTS_WITH" -> visitStartsWith(build(e.children()[0]),
build(e.children()[1]));
- case "ENDS_WITH" -> visitEndsWith(build(e.children()[0]),
build(e.children()[1]));
- case "CONTAINS" -> visitContains(build(e.children()[0]),
build(e.children()[1]));
+ case "STARTS_WITH", "ENDS_WITH", "CONTAINS" -> {
+ // The LIKE pattern is built from the value of the pattern argument,
so it must be a
+ // string literal. Any other pattern, such as a column, is not
supported.
+ if (!isNonNullStringLiteral(e.children()[1])) {
Review Comment:
Good point. Such a subclass would now keep the predicate in Spark instead of
pushing it down (results stay correct). I could move the check into a protected
method, e.g. `isSupportedLikePattern(Expression pattern)`, defaulting to a
non-null string literal, so that it can override it. Would that work for you?
--
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]