Skip to content

Commit dfc6dd5

Browse files
yjhjstzmy-ship-it
authored andcommitted
ORCA: Fix assertion failure for dynamic table scan rewindability
Implements EpetRewindability() method for CPhysicalDynamicTableScan to properly handle rewindability enforcement. The missing implementation caused assertion failures in CGroupExpression when validating plan contexts, as the optimizer couldn't determine if rewindability requirements were satisfied.
1 parent 8bde32c commit dfc6dd5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/backend/gporca/libgpopt/include/gpopt/operators/CPhysicalDynamicTableScan.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ class CPhysicalDynamicTableScan : public CPhysicalDynamicScan
7474
CPartitionPropagationSpec *PppsDerive(
7575
CMemoryPool *mp, CExpressionHandle &exprhdl) const override;
7676

77+
// return rewindability property enforcing type for this operator
78+
CEnfdProp::EPropEnforcingType EpetRewindability(CExpressionHandle &, const CEnfdRewindability *) const override;
79+
7780
}; // class CPhysicalDynamicTableScan
7881

7982
} // namespace gpopt

src/backend/gporca/libgpopt/src/operators/CPhysicalDynamicTableScan.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,19 @@ CPhysicalDynamicTableScan::PppsDerive(CMemoryPool *mp,
9191
return pps;
9292
}
9393

94+
95+
CEnfdProp::EPropEnforcingType
96+
CPhysicalDynamicTableScan::EpetRewindability(CExpressionHandle &exprhdl,
97+
const CEnfdRewindability *per) const
98+
{
99+
CRewindabilitySpec *prs = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Prs();
100+
if (per->FCompatible(prs))
101+
{
102+
// required rewindability is already provided
103+
return CEnfdProp::EpetUnnecessary;
104+
}
105+
106+
return CEnfdProp::EpetRequired;
107+
}
108+
94109
// EOF

0 commit comments

Comments
 (0)