//--------------------------------------------------------------------------- // @function: // CPhysicalComputeScalar::EpetDistribution // // @doc: // Return the enforcing type for distribution property based on this operator // //--------------------------------------------------------------------------- CEnfdProp::EPropEnforcingType CPhysicalComputeScalar::EpetDistribution ( CExpressionHandle &exprhdl, const CEnfdDistribution *ped ) const { GPOS_ASSERT(NULL != ped); // get distribution delivered by the filter node CDistributionSpec *pds = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Pds(); if (ped->FCompatible(pds)) { // required distribution is already provided return CEnfdProp::EpetUnnecessary; } if (exprhdl.FHasOuterRefs()) { return CEnfdProp::EpetProhibited; } return CEnfdProp::EpetRequired; }
//--------------------------------------------------------------------------- // @function: // CPhysicalAgg::EpetDistribution // // @doc: // Return the enforcing type for distribution property based on this operator // //--------------------------------------------------------------------------- CEnfdProp::EPropEnforcingType CPhysicalAgg::EpetDistribution ( CExpressionHandle &exprhdl, const CEnfdDistribution *ped ) const { GPOS_ASSERT(NULL != ped); // get distribution delivered by the aggregate node CDistributionSpec *pds = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Pds(); if (ped->FCompatible(pds)) { if (COperator::EgbaggtypeLocal != Egbaggtype()) { return CEnfdProp::EpetUnnecessary; } // prohibit the plan if local aggregate already delivers the enforced distribution, since // otherwise we would create two aggregates with no intermediate motion operators return CEnfdProp::EpetProhibited; } // if there are outer refs, we cannot have a motion on top if (exprhdl.FHasOuterRefs()) { return CEnfdProp::EpetProhibited; } // required distribution will be enforced on Agg's output return CEnfdProp::EpetRequired; }
//--------------------------------------------------------------------------- // @function: // CXformLeftAntiSemiApply2LeftAntiSemiJoin::Exfp // // @doc: // Compute xform promise for a given expression handle; // outer references are not allowed // //--------------------------------------------------------------------------- CXform::EXformPromise CXformLeftAntiSemiApply2LeftAntiSemiJoin::Exfp ( CExpressionHandle &exprhdl ) const { // if there are outer refs that include columns from the immediate outer child, the // transformation is applicable if (exprhdl.FHasOuterRefs(1 /*ulChildIndex*/) && !CUtils::FInnerUsesExternalColsOnly(exprhdl)) { return CXform::ExfpHigh; } return CXform::ExfpNone; }
//--------------------------------------------------------------------------- // @function: // CXformLeftAntiSemiApply2LeftAntiSemiJoinNoCorrelations::Exfp // // @doc: // Compute xform promise for a given expression handle; // outer references are not allowed // //--------------------------------------------------------------------------- CXform::EXformPromise CXformLeftAntiSemiApply2LeftAntiSemiJoinNoCorrelations::Exfp ( CExpressionHandle &exprhdl ) const { // if there are no outer references, or if all outer refs do not reference outer // child, the transformation is applicable if (!exprhdl.FHasOuterRefs(1 /*ulChildIndex*/) || CUtils::FInnerUsesExternalColsOnly(exprhdl)) { return CXform::ExfpHigh; } return CXform::ExfpNone; }
//--------------------------------------------------------------------------- // @function: // CPhysicalMotion::EpetRewindability // // @doc: // Return rewindability property enforcing type for this operator // //--------------------------------------------------------------------------- CEnfdProp::EPropEnforcingType CPhysicalMotion::EpetRewindability ( CExpressionHandle &exprhdl, const CEnfdRewindability * // per ) const { if (exprhdl.FHasOuterRefs()) { // motion has outer references: prohibit this plan // Note: this is a GPDB restriction as Motion operators are push-based return CEnfdProp::EpetProhibited; } // motion does not provide rewindability on its output return CEnfdProp::EpetRequired; }
//--------------------------------------------------------------------------- // @function: // CPhysicalTVF::EpetRewindability // // @doc: // Return the enforcing type for rewindability property based on this operator // //--------------------------------------------------------------------------- CEnfdProp::EPropEnforcingType CPhysicalTVF::EpetRewindability ( CExpressionHandle &exprhdl, const CEnfdRewindability *per ) const { // get rewindability delivered by the TVF node CRewindabilitySpec *prs = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Prs(); if (per->FCompatible(prs)) { // required distribution is already provided return CEnfdProp::EpetUnnecessary; } if (exprhdl.FHasOuterRefs()) { // a TVF should not have a materialize on top of it if it has an outer ref return CEnfdProp::EpetProhibited; } return CEnfdProp::EpetRequired; }