public static boolean updateOperatorCardinality(Operator o,
            Map<String, Integer> tableAliasToId,
            Map<String, TableStats> tableStats) {
        if (o instanceof Filter) {
            return updateFilterCardinality((Filter) o, tableAliasToId,
                    tableStats);
        } else if (o instanceof Join) {
            return updateJoinCardinality((Join) o, tableAliasToId, tableStats);
        } else if (o instanceof HashEquiJoin) {
            return updateHashEquiJoinCardinality((HashEquiJoin) o,
                    tableAliasToId, tableStats);
        } else if (o instanceof Aggregate) {
            return updateAggregateCardinality((Aggregate) o, tableAliasToId,
                    tableStats);
        } else {
            DbIterator[] children = o.getChildren();
            int childC = 1;
            boolean hasJoinPK = false;
            if (children.length > 0 && children[0] != null) {
                if (children[0] instanceof Operator) {
                    hasJoinPK = updateOperatorCardinality(
                            (Operator) children[0], tableAliasToId, tableStats);
                    childC = ((Operator) children[0]).getEstimatedCardinality();
                } else if (children[0] instanceof SeqScan) {
                    childC = tableStats.get(
                            ((SeqScan) children[0]).getTableName())
                            .estimateTableCardinality(1.0);
                }
            }
            o.setEstimatedCardinality(childC);
            return hasJoinPK;
        }
    }