924060929 commented on code in PR #69292:
URL: https://github.com/apache/doris/pull/69292#discussion_r4358396463


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/SearchExpression.java:
##########
@@ -23,21 +23,32 @@
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.BooleanType;
 import org.apache.doris.nereids.types.DataType;
+import org.apache.doris.nereids.util.SqlLiteralUtils;
 
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 
 /**
  * SearchExpression represents a search query with bound slot references.
  * This is created by RewriteSearchToSlots rule from Search scalar function.
  */
 public class SearchExpression extends Expression {
     private final String dslString;
+    // The second argument of search(dsl, options), kept so that toSql() 
reproduces the call.
+    private final Optional<String> optionsJson;
     private final SearchDslParser.QsPlan qsPlan;
 
     public SearchExpression(String dslString, SearchDslParser.QsPlan qsPlan, 
List<Expression> slotChildren) {
+        this(dslString, Optional.empty(), qsPlan, slotChildren);

Review Comment:
   Please pass the SEARCH options from the production rewrite path as well.
   
   `RewriteSearchToSlots.rewriteSearch` still constructs `new 
SearchExpression(search.getDslString(), qsPlan, slotChildren)`, which enters 
this overload and sets `optionsJson` to empty. Consequently, a call such as 
`search('apple pear', '{"default_field":"c1","default_operator":"or"}')` 
renders as only `search('apple pear')`, losing the field/operator settings in 
SQL/EXPLAIN output.
   
   The execution plan is already parsed with the options, so this is a 
non-blocking diagnostic issue rather than an established query-result error. 
Please use the four-argument constructor there with 
`Optional.ofNullable(search.getOptionsJson())` and add a test through 
`RewriteSearchToSlots`; the current `testToSqlKeepsOptions` directly constructs 
the four-argument object and therefore misses this production-path omission.



-- 
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