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

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit 17d1c0fa1ec00ba868a4cdc56a19889a398e039e
Author: Steve Carlin <[email protected]>
AuthorDate: Thu Nov 7 13:33:29 2024 -0800

    IMPALA-13528: Calcite planner; handle unsupported query options
    
    Unsupported query options will be run through the original planner.
    
    Change-Id: Ic1cc23a7447c052e81a42141ec052b6af4ad5e4a
    Reviewed-on: http://gerrit.cloudera.org:8080/22041
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 .../impala/calcite/service/CalciteJniFrontend.java     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteJniFrontend.java
 
b/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteJniFrontend.java
index ac96e8344..e5ab7e4ab 100644
--- 
a/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteJniFrontend.java
+++ 
b/java/calcite-planner/src/main/java/org/apache/impala/calcite/service/CalciteJniFrontend.java
@@ -84,6 +84,10 @@ public class CalciteJniFrontend extends JniFrontend {
 
     QueryContext queryCtx = new QueryContext(thriftQueryContext, 
getFrontend());
 
+    if (!optionSupportedInCalcite(queryCtx)) {
+      return runThroughOriginalPlanner(thriftQueryContext, queryCtx);
+    }
+
     try (FrontendProfile.Scope scope = FrontendProfile.createNewWithScope()) {
       LOG.info("Using Calcite Planner for the following query: " + 
queryCtx.getStmt());
 
@@ -166,6 +170,20 @@ public class CalciteJniFrontend extends JniFrontend {
     }
   }
 
+  private boolean optionSupportedInCalcite(QueryContext queryCtx) {
+    // IMPALA-13530
+    if 
(!queryCtx.getTQueryCtx().getClient_request().getQuery_options().isDecimal_v2())
 {
+      return false;
+    }
+
+    // IMPALA-13529
+    if (queryCtx.getTQueryCtx().getClient_request().getQuery_options()
+        .isAppx_count_distinct()) {
+      return false;
+    }
+    return true;
+  }
+
   private static void loadCalciteImpalaFunctions() {
     ImpalaOperatorTable.create(BuiltinsDb.getInstance());
   }

Reply via email to