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_r391114166
##########
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:
We should mind current Drill behavior in this case. Currently user can set
boolean option using in any case (current example for `true` value, the same is
for false, other values are not allowed):
```
set metastore.enabled = TRUE;
set metastore.enabled = True;
set metastore.enabled = true;
```
I think for the user it would be a surprise that behavior is different. So I
think we should add case-insensitivity for boolean options.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services