You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/08/11 06:28:46 UTC

[GitHub] [druid] kfaraz commented on a change in pull request #11566: Enable routing of SQL queries at Router

kfaraz commented on a change in pull request #11566:
URL: https://github.com/apache/druid/pull/11566#discussion_r686535216



##########
File path: services/src/main/java/org/apache/druid/server/router/TieredBrokerHostSelector.java
##########
@@ -257,6 +267,37 @@ public String getDefaultServiceName()
     return new Pair<>(brokerServiceName, nodesHolder.pick());
   }
 
+  public Pair<String, Server> selectForSql(SqlQuery sqlQuery)
+  {
+    synchronized (lock) {
+      if (!ruleManager.isStarted() || !started) {
+        return getDefaultLookup();
+      }
+    }
+
+    // Resolve brokerServiceName using Tier selector strategies
+    String brokerServiceName = null;
+    for (TieredBrokerSelectorStrategy strategy : strategies) {
+      final Optional<String> optionalName = strategy.getBrokerServiceName(tierConfig, sqlQuery);
+      if (optionalName.isPresent()) {
+        brokerServiceName = optionalName.get();
+        break;
+      }
+    }
+
+    // Use defaut if not resolved by strategies
+    if (brokerServiceName == null) {
+      log.error(
+          "No brokerServiceName found for SQL Query [%s]. Using default selector for [%s].",

Review comment:
       Sounds good.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org