ygerzhedovich commented on code in PR #4992: URL: https://github.com/apache/ignite-3/pull/4992#discussion_r1901668559
########## 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. Review Comment: It will be good to add an explanation of what a `foreign key` is from Ignite perspective, due to we don't support such relations now ########## 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: why fallback to maximum row count used here instead of just 1 ########## 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. Review Comment: I see mention in JoiningRelationType, but I should understand it when I read just this javadoc. Maybe will be good just to add link to the enum here -- 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