int cardinality = QueryMetadataInterface.UNKNOWN_CARDINALITY;
if (plan instanceof RelationalPlan) {
RelationalPlan relationalPlan = (RelationalPlan)plan;
RelationalNode root = relationalPlan.getRootNode();
//since the root will be a project into node, get the cost from its child
if (root.getChildren()[0] != null) {
root = root.getChildren()[0];
}
Number planCardinality = root.getEstimateNodeCardinality();
if (planCardinality == null || planCardinality.floatValue() == NewCalculateCostUtil.UNKNOWN_VALUE) {
//don't stage unknown cost without criteria
if (implicit && query.getCriteria() == null) {
return false;