korlov42 commented on a change in pull request #9392:
URL: https://github.com/apache/ignite/pull/9392#discussion_r744689871



##########
File path: 
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/StatisticsUtils.java
##########
@@ -172,4 +174,61 @@ public static StatisticsTarget 
statisticsTarget(StatisticsKeyMessage msg) {
         String[] cols = (msg.colNames() == null) ? null : 
msg.colNames().toArray(new String[0]);
         return new StatisticsTarget(msg.schema(), msg.obj(), cols);
     }
+
+    /**
+     * Test if specified statistics is fit to all required versions.
+     * It means that specified statistics contains all columns with at least 
versions
+     * from specified map.
+     *
+     * @param stat Statistics to check. Can be {@code null}.
+     * @param versions Map of column name to required version.
+     * @return {@code true} if it is, {@code false} otherwise.
+     */
+    public static int compareVersions(
+        ObjectStatisticsImpl stat,
+        Map<String, Long> versions
+    ) {
+        if (stat == null)
+            return -1;
+
+        for (Map.Entry<String, Long> version : versions.entrySet()) {
+            ColumnStatistics colStat = 
stat.columnsStatistics().get(version.getKey());
+
+            if (colStat == null || colStat.version() < version.getValue())

Review comment:
       from javadoc: `specified statistics contains all columns with at least 
versions from specified map`, but in fact the method returns as soon as the 
very first non equal version have found




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