The estimateRowCount method of DataSetCalc didn't work in the following situation.
If I run the following code,
the cost of every node in Optimized node tree is :
We expect the input rowcount of DataSetAggregate less than 1000, however the actual input rowcount is still 1000 because the the estimateRowCount method of DataSetCalc didn't work.
The problem is similar to the issue https://issues.apache.org/jira/browse/FLINK-5394 which is already solved.
I find although we set metadata provider to FlinkDefaultRelMetadataProvider in FlinkRelBuilder, but after run
to translate SqlNode to RelNode, the metadata provider would be overrided from FlinkDefaultRelMetadataProvider to DefaultRelMetadataProvider again because of the following code: