Metadata about a relational expression.
For particular types of metadata, a sub-class defines one of more methods
to query that metadata. Then a
RelMetadataProvider can offer those
kinds of metadata for particular sub-classes of
RelNode.
User code (typically in a planner rule or an implementation of
RelNode#computeSelfCost(org.apache.calcite.plan.RelOptPlanner,RelMetadataQuery))
acquires a
Metadata instance by calling
RelNode#metadata.
A
Metadata instance already knows which particular
RelNodeit is describing, so the methods do not pass in the
RelNode. In fact,
quite a few metadata methods have no extra parameters. For instance, you can
get the row-count as follows:
RelNode rel;
double rowCount = rel.metadata(RowCount.class).rowCount();