zstan commented on a change in pull request #8959:
URL: https://github.com/apache/ignite/pull/8959#discussion_r606135832
##########
File path:
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/RexUtils.java
##########
@@ -275,6 +281,46 @@ else if (bestLower != null) { // "x>5"
return new IndexConditions(lower, upper, lowerBound, upperBound);
}
+ /**
+ * Builds index conditions.
+ */
+ public static List<RexNode> buildHashSearchRow(
+ RelOptCluster cluster,
+ RexNode condition,
+ RelDataType rowType
+ ) {
+ condition = RexUtil.toCnf(builder(cluster), condition);
+
+ Map<Integer, List<RexCall>> fieldsToPredicates =
mapPredicatesToFields(condition, cluster);
+
+ if (F.isEmpty(fieldsToPredicates))
+ return null;
+
+ List<RexNode> searchPreds = new ArrayList<>();
+
+ for (int fldIdx : fieldsToPredicates.keySet()) {
+ List<RexCall> collFldPreds = fieldsToPredicates.get(fldIdx);
+
+ if (F.isEmpty(collFldPreds))
+ break;
+
+ for (RexCall pred : collFldPreds) {
+ if (U.assertionsEnabled()) {
+ RexNode cond = RexUtil.removeCast(pred.operands.get(1));
+
+ assert idxOpSupports(cond) : cond;
+ }
+
+ if (pred.getOperator().kind != SqlKind.EQUALS)
+ return null;
+
Review comment:
if (searchPreds == null)
searchPreds = new ArrayList<>();
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]