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

apurtell pushed a commit to branch PHOENIX-7876-feature
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-7876-feature by this 
push:
     new 4a4ace8918 PHOENIX-7927 Fix EXPLAIN plumbing related NPE in 
DelegateQueryPlan.setOptimizerDecision (#2532)
4a4ace8918 is described below

commit 4a4ace89183729dcf50f51cfd4309485a47bea63
Author: Andrew Purtell <[email protected]>
AuthorDate: Mon Jun 15 08:41:53 2026 -0700

    PHOENIX-7927 Fix EXPLAIN plumbing related NPE in 
DelegateQueryPlan.setOptimizerDecision (#2532)
    
    Co-authored-by: Claude Opus 4.8[1m] <[email protected]>
---
 .../java/org/apache/phoenix/execute/DelegateQueryPlan.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateQueryPlan.java
 
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateQueryPlan.java
index 3ca9b8e059..ac3616e2c0 100644
--- 
a/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateQueryPlan.java
+++ 
b/phoenix-core-client/src/main/java/org/apache/phoenix/execute/DelegateQueryPlan.java
@@ -39,6 +39,10 @@ import org.apache.phoenix.schema.TableRef;
 
 public abstract class DelegateQueryPlan implements QueryPlan {
   protected final QueryPlan delegate;
+  // Fallback storage for the optimizer decision used only when this plan has 
no delegate to
+  // forward to. Some DelegateQueryPlan subclasses intentionally pass a null 
delegate and override
+  // getContext()/getTableRef()/getProjector() to serve from local state.
+  private OptimizerDecision optimizerDecision;
 
   public DelegateQueryPlan(QueryPlan delegate) {
     this.delegate = delegate;
@@ -175,11 +179,15 @@ public abstract class DelegateQueryPlan implements 
QueryPlan {
 
   @Override
   public OptimizerDecision getOptimizerDecision() {
-    return delegate.getOptimizerDecision();
+    return delegate != null ? delegate.getOptimizerDecision() : 
optimizerDecision;
   }
 
   @Override
   public void setOptimizerDecision(OptimizerDecision decision) {
-    delegate.setOptimizerDecision(decision);
+    if (delegate != null) {
+      delegate.setOptimizerDecision(decision);
+    } else {
+      this.optimizerDecision = decision;
+    }
   }
 }

Reply via email to