Calcite tables (org.apache.calcite.schema.Table) should implement the method org.apache.calcite.schema.Statistic getStatistic(). The Statistic instance returned by this method is used for the Volcano optimizer in Calcite.
Currently, org.apache.beam.sdk.extensions.sql.impl.BeamCalciteTable has not implemented getStatistic() which means it uses the implementation in org.apache.calcite.schema.impl.AbstractTable and that implementation just returns Statistics.UNKNOWN for all sources.
Things needed to be implemented:
1- Implementing getStatistic in BeamCalciteTable such that it calls a row count estimation method from BeamSqlTable and adding this method to BeamSqlTable.
2- Implementing the row count estimation method for BigQueryTable.