zstan commented on code in PR #1476:
URL: https://github.com/apache/ignite-3/pull/1476#discussion_r1058341006
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/RexUtils.java:
##########
@@ -361,46 +364,58 @@ public static List<SearchBounds> buildHashIndexConditions(
}
/**
- * Builds index conditions.
+ * Builds hash index search bounds.
*/
- public static List<RexNode> buildHashSearchRow(
+ public static List<SearchBounds> buildHashSearchBounds(
RelOptCluster cluster,
RexNode condition,
- RelDataType rowType
+ RelDataType rowType,
+ @Nullable ImmutableBitSet requiredColumns
) {
condition = RexUtil.toCnf(builder(cluster), condition);
- Int2ObjectMap<List<RexCall>> fieldsToPredicates =
mapPredicatesToFields(condition, cluster);
+ Map<Integer, List<RexCall>> fieldsToPredicates =
mapPredicatesToFields(condition, cluster);
if (nullOrEmpty(fieldsToPredicates)) {
return null;
}
- List<RexNode> searchPreds = null;
+ List<SearchBounds> bounds = null;
+
+ List<RelDataType> types = RelOptUtil.getFieldTypeList(rowType);
+
+ Mappings.TargetMapping mapping = null;
+
+ if (requiredColumns != null) {
+ mapping = Commons.inverseTrimmingMapping(types.size(),
requiredColumns);
+ }
+
+ for (int fldIdx : fieldsToPredicates.keySet()) {
+ List<RexCall> collFldPreds = fieldsToPredicates.get(fldIdx);
- for (List<RexCall> collFldPreds : fieldsToPredicates.values()) {
if (nullOrEmpty(collFldPreds)) {
break;
}
for (RexCall pred : collFldPreds) {
- if (pred.getOperator().kind != SqlKind.EQUALS) {
+ if (pred.getOperator().kind != SqlKind.EQUALS &&
pred.getOperator().kind != IS_NOT_DISTINCT_FROM) {
Review Comment:
don`t understand here, for hash search we can use only **equality** or **is
not distinct** operands, plz explain your idea.
--
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]