davidradl commented on code in PR #26155: URL: https://github.com/apache/flink/pull/26155#discussion_r1954617030
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/metadata/SelectivityEstimator.scala: ########## @@ -541,7 +541,14 @@ class SelectivityEstimator(rel: RelNode, mq: FlinkRelMetadataQuery) } val columnInterval = mq.getColumnInterval(rel, inputRef.getIndex) if (columnInterval == null) { - return defaultEqualsSelectivity + // For types like VARCHAR, it has no 'interval' concept but may also contain different values. + // We utilize ndv to get a better estimate. + val ndv = mq. getDistinctRowCount(rel, ImmutableBitSet.of(inputRef.getIndex), null) Review Comment: Can I confirm getDistinctRowCount is accessing existing statistics and is not doing anything non-performant? -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org