korlov42 commented on code in PR #4992:
URL: https://github.com/apache/ignite-3/pull/4992#discussion_r1905364002


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/metadata/IgniteMdRowCount.java:
##########
@@ -100,68 +106,334 @@ public double getRowCount(IgniteLimit rel, 
RelMetadataQuery mq) {
     }
 
     /**
-     * JoinRowCount.
-     * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+     * Estimates the number of rows produced by a join operation.
+     *
+     * <p>This method calculates an estimated row count for a join by 
analyzing the join type,
+     * join keys, and the cardinality of the left and right inputs. It 
provides specialized
+     * handling for primary key and foreign key relationships. When certain 
metadata is unavailable
+     * or when specific conditions are not met, it falls back to Calcite's 
default implementation
+     * for estimating the row count.
+     *
+     * <p>Implementation details:</p>
+     * <ul>
+     *   <li>If the join type is not {@link JoinRelType#INNER}, Calcite's 
default implementation is used.</li>
+     *   <li>If the join is non-equi join, Calcite's default implementation is 
used.</li>
+     *   <li>The row counts of the left and right inputs are retrieved using 
+     *   {@link RelMetadataQuery#getRowCount}. If either value is unavailable, 
the result is {@code null}.</li>
+     *   <li>If the row counts are very small (≤ 1.0), the method uses the 
maximum row count as a fallback.</li>

Review Comment:
   this is inlined fallback to Calcite's default implementation, see 
`org.apache.calcite.rel.metadata.RelMdUtil#getJoinRowCount`



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to