[ 
https://issues.apache.org/jira/browse/HIVE-27238?focusedWorklogId=858996&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-858996
 ]

ASF GitHub Bot logged work on HIVE-27238:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Apr/23 17:56
            Start Date: 25/Apr/23 17:56
    Worklog Time Spent: 10m 
      Work Description: kasakrisz commented on code in PR #4212:
URL: https://github.com/apache/hive/pull/4212#discussion_r1176852722


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveDefaultRelMetadataProvider.java:
##########
@@ -128,4 +139,28 @@ public static void 
initializeMetadataProviderClass(List<Class<? extends RelNode>
     // This will register the classes in the default Hive implementation
     DEFAULT.register(nodeClasses);
   }
+
+  public static synchronized HiveDefaultRelMetadataProvider get(HiveConf 
hiveConf,
+      List<Class<? extends RelNode>> nodeClasses) {
+    Map<HiveConf.ConfVars, Object> confKey = getConfKey(hiveConf);
+    if (ALL_PROVIDERS.containsKey(confKey)) {
+      return ALL_PROVIDERS.get(confKey);
+    }
+
+    HiveDefaultRelMetadataProvider newProvider =
+        new HiveDefaultRelMetadataProvider(hiveConf, nodeClasses);
+    ALL_PROVIDERS.put(confKey, newProvider);
+    return newProvider;
+  }
+
+  private static Map<HiveConf.ConfVars, Object> getConfKey(HiveConf conf) {
+    ImmutableMap.Builder<HiveConf.ConfVars, Object> bldr = new 
ImmutableMap.Builder<>();
+    bldr.put(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE,
+        conf.getVar(HiveConf.ConfVars.HIVE_EXECUTION_ENGINE));
+    bldr.put(HiveConf.ConfVars.HIVE_CBO_EXTENDED_COST_MODEL,
+        conf.getBoolVar(HiveConf.ConfVars.HIVE_CBO_EXTENDED_COST_MODEL));
+    bldr.put(HiveConf.ConfVars.MAPREDMAXSPLITSIZE,
+        conf.getLongVar(HiveConf.ConfVars.MAPREDMAXSPLITSIZE));

Review Comment:
   Are these settings can be changed without hs2 restart?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 858996)
    Time Spent: 40m  (was: 0.5h)

> Avoid Calcite Code generation for RelMetaDataProvider on every query
> --------------------------------------------------------------------
>
>                 Key: HIVE-27238
>                 URL: https://issues.apache.org/jira/browse/HIVE-27238
>             Project: Hive
>          Issue Type: Improvement
>          Components: HiveServer2
>            Reporter: Steve Carlin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> In CalcitePlanner, we are instantiating a new CachingRelMetadataProvider on 
> every query.  Within the Calcite code, they keep the provider key to prevent 
> a new MetadataHandler class from being created.  But by generating a new 
> provider, the cache never gets a hit so we keep instantiating new 
> MetadataHandlers.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to