zstan commented on code in PR #13011:
URL: https://github.com/apache/ignite/pull/13011#discussion_r3101791702
##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AbstractPlannerTest.java:
##########
@@ -619,6 +626,49 @@ protected <T extends RelNode> Predicate<RelNode>
input(Predicate<T> predicate) {
return input(0, predicate);
}
+ /** Low level conditions analyzer. */
+ private static boolean validateIdxConditions(IgniteIndexScan node, SqlKind
opKind, String... strConditions) {
+ /** */
+ Set<String> conditions = new HashSet<>();
+
+ /** */
+ RexShuttle shuttle = new RexShuttle() {
+ boolean firstCall = true;
+
+ @Override public RexNode visitCall(RexCall call) {
+ if (firstCall) {
Review Comment:
but ... it doesn`t work as expected (
```
RexBuilder builder = node.getCluster().getRexBuilder();
RexLiteral l0 = builder.makeExactLiteral(new BigDecimal(0));
RexLocalRef lr0 = new RexLocalRef(0,
node.getCluster().getTypeFactory().createJavaType(long.class));
RexLiteral l1 = builder.makeExactLiteral(new BigDecimal(0));
RexLocalRef lr1 = new RexLocalRef(1,
node.getCluster().getTypeFactory().createJavaType(long.class));
final RangeSet<Integer> setNone = ImmutableRangeSet.of();
final RangeSet<Integer> setAll = setNone.complement();
final Sarg<Integer> sarg =
Sarg.of(RexUnknownAs.FALSE, setAll);
RexNode intLiteral =
builder.makeLiteral(1,
node.getCluster().getTypeFactory().createSqlType(SqlTypeName.INTEGER));
RexNode rexNode =
builder.makeCall(SqlStdOperatorTable.SEARCH, intLiteral,
builder.makeSearchArgumentLiteral(sarg,
intLiteral.getType()));
RexLocalRef lr2 = new RexLocalRef(2,
node.getCluster().getTypeFactory().createJavaType(long.class));
RexNode r0 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr0,
l0);
RexNode r1 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr1,
l1);
RexNode r3 = builder.makeCall(SqlStdOperatorTable.EQUALS, lr2,
rexNode);
RexNode res = builder.makeCall(SqlStdOperatorTable.AND, r1, r0,
r3);
String norm =
normalizeExpression(node.getCluster().getRexBuilder(), res).toString();
System.err.println("node >>: " + res);
System.err.println("norm >>: " + norm);
```
returns:
```
node >>: AND(=($t1, 0), =($t0, 0), =($t2, SEARCH(1, Sarg[IS NOT NULL])))
norm >>: AND(=($t1, 0), =($t0, 0), =($t2, SEARCH(1, Sarg[IS NOT NULL])))
```
--
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]