This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new dfc6dd580e2 ORCA: Fix assertion failure for dynamic table scan 
rewindability
dfc6dd580e2 is described below

commit dfc6dd580e2e43a93aa1a5168a4d54ee5541eab9
Author: Jianghua Yang <[email protected]>
AuthorDate: Sat Dec 27 08:02:32 2025 -0800

    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.
---
 .../include/gpopt/operators/CPhysicalDynamicTableScan.h   |  3 +++
 .../libgpopt/src/operators/CPhysicalDynamicTableScan.cpp  | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

diff --git 
a/src/backend/gporca/libgpopt/include/gpopt/operators/CPhysicalDynamicTableScan.h
 
b/src/backend/gporca/libgpopt/include/gpopt/operators/CPhysicalDynamicTableScan.h
index 6fa75f7fbe1..94d7435ca05 100644
--- 
a/src/backend/gporca/libgpopt/include/gpopt/operators/CPhysicalDynamicTableScan.h
+++ 
b/src/backend/gporca/libgpopt/include/gpopt/operators/CPhysicalDynamicTableScan.h
@@ -74,6 +74,9 @@ public:
        CPartitionPropagationSpec *PppsDerive(
                CMemoryPool *mp, CExpressionHandle &exprhdl) const override;
 
+       // return rewindability property enforcing type for this operator
+       CEnfdProp::EPropEnforcingType EpetRewindability(CExpressionHandle &, 
const CEnfdRewindability *) const override;
+
 };     // class CPhysicalDynamicTableScan
 
 }  // namespace gpopt
diff --git 
a/src/backend/gporca/libgpopt/src/operators/CPhysicalDynamicTableScan.cpp 
b/src/backend/gporca/libgpopt/src/operators/CPhysicalDynamicTableScan.cpp
index b768d623963..6b7788a22a2 100644
--- a/src/backend/gporca/libgpopt/src/operators/CPhysicalDynamicTableScan.cpp
+++ b/src/backend/gporca/libgpopt/src/operators/CPhysicalDynamicTableScan.cpp
@@ -91,4 +91,19 @@ CPhysicalDynamicTableScan::PppsDerive(CMemoryPool *mp,
        return pps;
 }
 
+
+CEnfdProp::EPropEnforcingType
+CPhysicalDynamicTableScan::EpetRewindability(CExpressionHandle &exprhdl,
+                                                                               
         const CEnfdRewindability *per) const
+{
+       CRewindabilitySpec *prs = CDrvdPropPlan::Pdpplan(exprhdl.Pdp())->Prs();
+       if (per->FCompatible(prs))
+       {
+               // required rewindability is already provided
+               return CEnfdProp::EpetUnnecessary;
+       }
+
+       return CEnfdProp::EpetRequired;
+}
+
 // EOF


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to