@Override public Double getRowCount(SemiJoin rel, RelMetadataQuery mq) { PKFKRelationInfo pkfk = analyzeJoinForPKFK(rel, mq); if (pkfk != null) { double selectivity = pkfk.pkInfo.selectivity * pkfk.ndvScalingFactor; selectivity = Math.min(1.0, selectivity); if (LOG.isDebugEnabled()) { LOG.debug("Identified Primary - Foreign Key relation: {} {}", RelOptUtil.toString(rel), pkfk); } return pkfk.fkInfo.rowCount * selectivity; } return super.getRowCount(rel, mq); }
@Override public Double getRowCount(SemiJoin rel, RelMetadataQuery mq) { PKFKRelationInfo pkfk = analyzeJoinForPKFK(rel, mq); if (pkfk != null) { double selectivity = (pkfk.pkInfo.selectivity * pkfk.ndvScalingFactor); selectivity = Math.min(1.0, selectivity); if (LOG.isDebugEnabled()) { LOG.debug("Identified Primary - Foreign Key relation: {} {}", RelOptUtil.toString(rel), pkfk); } return pkfk.fkInfo.rowCount * selectivity; } return super.getRowCount(rel, mq); }
@Override public Double getRowCount(Aggregate rel, RelMetadataQuery mq) { ImmutableBitSet groupKey = ImmutableBitSet.range(rel.getGroupCount()); if (groupKey.isEmpty()) { return 1.0; } else { return super.getRowCount(rel, mq); } }
@Override public Double getRowCount(Join rel, RelMetadataQuery mq) { if (rel.getCondition().isAlwaysTrue()) { return super.getRowCount(rel, mq); } else { return Math.max(mq.getRowCount(rel.getLeft()), mq.getRowCount(rel.getRight())); } }
public Double getRowCount(SemiJoin rel) { PKFKRelationInfo pkfk = analyzeJoinForPKFK(rel); if (pkfk != null) { double selectivity = (pkfk.pkInfo.selectivity * pkfk.ndvScalingFactor); selectivity = Math.min(1.0, selectivity); if (LOG.isDebugEnabled()) { LOG.debug("Identified Primary - Foreign Key relation:"); LOG.debug(RelOptUtil.toString(rel)); LOG.debug(pkfk); } return pkfk.fkInfo.rowCount * selectivity; } return super.getRowCount(rel); }