Gabriel39 commented on code in PR #69672:
URL: https://github.com/apache/doris/pull/69672#discussion_r4400246730
##########
fe/fe-connector/fe-connector-es/src/main/java/org/apache/doris/connector/es/EsQueryDslBuilder.java:
##########
@@ -307,6 +356,32 @@ private static String notToDsl(ConnectorNot not,
boolean likePushDown,
List<String> needCompatDateFields,
Map<String, String> column2typeMap) {
+ // Optimizer NOT simplification is optional. Inverting a comparison
keeps NULL as
+ // UNKNOWN; complementing its ES true-set would instead make missing
values match.
+ ConnectorExpression operand = not.getOperand();
+ ConnectorExpression normalized = null;
+ if (operand instanceof ConnectorNot) {
+ normalized = ((ConnectorNot) operand).getOperand();
+ } else if (operand instanceof ConnectorComparison) {
+ ConnectorComparison comparison = (ConnectorComparison) operand;
+ ConnectorComparison.Operator inverse =
negateOperator(comparison.getOperator());
+ if (inverse != null) {
+ normalized = new ConnectorComparison(inverse,
comparison.getLeft(), comparison.getRight());
Review Comment:
Fixed in bbe765a93d950f19fbd7a73b494ab2917b52783b.
Retained range NOT now complements the original ES range query and
separately requires field existence. It no longer substitutes the inverse
existential range, so [1,2] cannot satisfy NOT(n<2) by matching its second
member. Equality negation, double NOT, Boolean decomposition and scalar NULL
rejection remain covered. Added FE tests for all four original range-complement
shapes and live LT/LE threshold-spanning arrays with scalar, NULL and
native-esquery controls while SIMPLIFY_NOT_EXPR is disabled; the session
setting is restored. All prior scalar NOT/NULL regressions also pass.
Validation: 159 FE tests passed (one optional ES9 class skipped), all 17 BE
unit tests passed, and five live ES8 suites passed 1,612 stored checks and
1,516 independent comparisons. All 1,452 previous stored results are unchanged.
The 160 new outputs were generated and independently rerun without generation.
Standard ASAN BE build, FE Checkstyle, clang-format 16, scoped clang-tidy and
build hygiene passed.
--
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]