alex-plekhanov commented on code in PR #12926:
URL: https://github.com/apache/ignite/pull/12926#discussion_r3033301215


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java:
##########
@@ -404,11 +404,12 @@ private boolean hasExchange(RelNode rel) {
         List<SearchBounds> searchBounds = rel.searchBounds();
 
         RelDataType inputRowType = rel.getDataSourceRowType();
+        RelCollation rangeCollation = 
Objects.requireNonNullElse(rel.keyFieldCollation(), rel.collation());
 
         Predicate<Row> filters = condition == null ? null : 
expressionFactory.predicate(condition, inputRowType);
         Function<Row, Row> prj = projects == null ? null : 
expressionFactory.project(projects, inputRowType);
         RangeIterable<Row> ranges = searchBounds == null ? null :
-            expressionFactory.ranges(searchBounds, rel.collation(), 
tbl.getRowType(typeFactory));
+            expressionFactory.ranges(searchBounds, rangeCollation, 
tbl.getRowType(typeFactory));

Review Comment:
   I propose to change `ranges` method instaad of adding `keyFieldCollation` 
and serialize it
   In range we can do something like:
   ```
           if (collation.getKeys().isEmpty()) {
               collation = RelCollations.of(IntStream.range(0, 
searchBounds.size())
                   .filter(i -> searchBounds.get(i) != null)
                   .mapToObj(RelFieldCollation::new)
                   .collect(Collectors.toList())
               );
           }
   ```
   All code related to `keyFieldCollation` can be deleted (starting from 
`CacheWrappedKeyIndexImpl.deriveKeyFieldIndexCollation`)



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

Reply via email to