morrySnow commented on code in PR #67749:
URL: https://github.com/apache/doris/pull/67749#discussion_r3975040422
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/NgramSearch.java:
##########
@@ -47,19 +48,28 @@ public class NgramSearch extends ScalarFunction
*/
public NgramSearch(Expression arg0, Expression arg1, Expression arg2) {
super("ngram_search", arg0, arg1, arg2);
- if (!(arg1.isConstant())) {
+ }
+
+ /** constructor for withChildren and reuse signature */
+ private NgramSearch(ScalarFunctionParams functionParams) {
+ super(functionParams);
+ }
+
+ @Override
+ public void checkLegalityBeforeTypeCoercion() {
+ if (!child(1).isConstant()) {
throw new AnalysisException(
"ngram_search(text,pattern,gram_num): pattern support
const value only.");
}
- if (!(arg2.isConstant())) {
+ Expression gramNum = child(2);
+ if (!gramNum.isConstant()) {
Review Comment:
如果要求必须是literal,这里直接检查是不是literal,而不是constant
--
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]