drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [drill] arina-ielchiieva commented on a change in pull request #1997: DRILL-7604: Allow session options to be set in HTTP queries
Date Wed, 11 Mar 2020 17:01:48 GMT
arina-ielchiieva commented on a change in pull request #1997: DRILL-7604: Allow session options
to be set in HTTP queries
URL: https://github.com/apache/drill/pull/1997#discussion_r391122758
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
 ##########
 @@ -110,6 +118,50 @@ public Viewable submitQuery(@FormParam("query") String query,
     }
   }
 
+  private Map<String, Object> readOptionsFromForm(Form form) {
+    Map<String, Object> options = new HashMap<>();
+    SessionOptionManager sessionOptionManager = webUserConnection.getSession().getOptions();
+    for (Map.Entry<String, List<String>> pair : form.asMap().entrySet()) {
+      String name = pair.getKey();
+      OptionDefinition definition = sessionOptionManager.getOptionDefinition(name);
+      if (definition != null) {
+        String valueStr = pair.getValue().get(0);
+        if (!valueStr.isEmpty()) {
+          try {
+            Object value = null;
+            switch (definition.getValidator().getKind()) {
+              case BOOLEAN:
+                if ("true".equals(valueStr)) {
 
 Review comment:
   @dobesv I know you are not interested in proper implementation but frankly saying much
better solution would be to mimic the way options are updated on Options tab, user would enter
option name, its kind (from drop down) and depending on the kind value. And then update process
would require only several line in the server side. Please see example: https://github.com/apache/drill/blob/ab60b3d8e5d062edaccb9d292fac95d076d322e5/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StatusResources.java#L183

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message