public MapJoinStreamingRelation getStreamingSide() { RelMetadataQuery mq = RelMetadataQuery.instance(); Double leftInputSize = mq.memory(left); Double rightInputSize = mq.memory(right); if (leftInputSize == null && rightInputSize == null) { return MapJoinStreamingRelation.NONE; } else if (leftInputSize != null && (rightInputSize == null || (leftInputSize < rightInputSize))) { return MapJoinStreamingRelation.RIGHT_RELATION; } else if (rightInputSize != null && (leftInputSize == null || (rightInputSize <= leftInputSize))) { return MapJoinStreamingRelation.LEFT_RELATION; } return MapJoinStreamingRelation.NONE; }
public MapJoinStreamingRelation getStreamingSide() { RelMetadataQuery mq = left.getCluster().getMetadataQuery(); Double leftInputSize = mq.memory(left); Double rightInputSize = mq.memory(right); if (leftInputSize == null && rightInputSize == null) { return MapJoinStreamingRelation.NONE; } else if (leftInputSize != null && (rightInputSize == null || (leftInputSize < rightInputSize))) { return MapJoinStreamingRelation.RIGHT_RELATION; } else if (rightInputSize != null && (leftInputSize == null || (rightInputSize <= leftInputSize))) { return MapJoinStreamingRelation.LEFT_RELATION; } return MapJoinStreamingRelation.NONE; }
public MapJoinStreamingRelation getStreamingSide() { Double leftInputSize = RelMetadataQuery.memory(left); Double rightInputSize = RelMetadataQuery.memory(right); if (leftInputSize == null && rightInputSize == null) { return MapJoinStreamingRelation.NONE; } else if (leftInputSize != null && (rightInputSize == null || (leftInputSize < rightInputSize))) { return MapJoinStreamingRelation.RIGHT_RELATION; } else if (rightInputSize != null && (leftInputSize == null || (rightInputSize <= leftInputSize))) { return MapJoinStreamingRelation.LEFT_RELATION; } return MapJoinStreamingRelation.NONE; }
/** Catch-all implementation for * {@link BuiltInMetadata.Memory#cumulativeMemoryWithinPhase()}, * invoked using reflection. * * @see org.apache.calcite.rel.metadata.RelMetadataQuery#memory */ public Double cumulativeMemoryWithinPhase(RelNode rel, RelMetadataQuery mq) { Double nullable = mq.memory(rel); if (nullable == null) { return null; } Boolean isPhaseTransition = mq.isPhaseTransition(rel); if (isPhaseTransition == null) { return null; } double d = nullable; if (!isPhaseTransition) { for (RelNode input : rel.getInputs()) { nullable = mq.cumulativeMemoryWithinPhase(input); if (nullable == null) { return null; } d += nullable; } } return d; }
/** Catch-all implementation for * {@link BuiltInMetadata.Memory#cumulativeMemoryWithinPhase()}, * invoked using reflection. * * @see org.apache.calcite.rel.metadata.RelMetadataQuery#memory */ public Double cumulativeMemoryWithinPhase(RelNode rel, RelMetadataQuery mq) { Double nullable = mq.memory(rel); if (nullable == null) { return null; } Boolean isPhaseTransition = mq.isPhaseTransition(rel); if (isPhaseTransition == null) { return null; } double d = nullable; if (!isPhaseTransition) { for (RelNode input : rel.getInputs()) { nullable = mq.cumulativeMemoryWithinPhase(input); if (nullable == null) { return null; } d += nullable; } } return d; }
assertThat(mq.memory(aggregate), nullValue()); assertThat(mq.cumulativeMemoryWithinPhase(aggregate), nullValue());
assertThat(mq.memory(aggregate), nullValue()); assertThat(mq.cumulativeMemoryWithinPhase(aggregate), nullValue());