luocooong commented on a change in pull request #2474:
URL: https://github.com/apache/drill/pull/2474#discussion_r815848665
##########
File path:
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java
##########
@@ -172,6 +179,8 @@ public HttpPaginatorConfig paginator() {
return this.paginator;
}
+ public String getPostParameterLocation() { return postParameterLocation; }
Review comment:
It is recommended that the code style be consistent.
```suggestion
public String postParameterLocation() {
return this.postParameterLocation;
}
```
##########
File path:
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpBatchReader.java
##########
@@ -218,6 +219,14 @@ protected HttpUrl buildUrl() {
protected void addFilters(Builder urlBuilder, List<String> params,
Map<String, String> filters) {
+ // If the request is a POST query and the user selected to push the
filters to either JSON body
+ // or the post body, do not add to the query string.
+ if (subScan.tableSpec().connectionConfig().getMethodType() ==
HttpApiConfig.HttpMethod.POST &&
+
(subScan.tableSpec().connectionConfig().getPostParameterLocation().equalsIgnoreCase(HttpApiConfig.POST_BODY_POST_LOCATION)
||
+
subScan.tableSpec().connectionConfig().getPostParameterLocation().equalsIgnoreCase(HttpApiConfig.JSON_BODY_POST_LOCATION)
)
Review comment:
There is an extra whitespace.
##########
File path:
contrib/storage-http/src/main/java/org/apache/drill/exec/store/http/HttpApiConfig.java
##########
@@ -271,6 +282,10 @@ private HttpApiConfig(HttpApiConfig.HttpApiConfigBuilder
builder) {
// Accept either basic or none. The default is none.
this.authType = StringUtils.defaultIfEmpty(builder.authType, "none");
this.postBody = builder.postBody;
+
+ // Default to query string to avoid breaking changes
+ this.postParameterLocation =
StringUtils.defaultIfEmpty(builder.postParameterLocation.trim().toLowerCase(),
QUERY_STRING_POST_LOCATION);
Review comment:
Is it possible to use enum type to define the `postParameterLocation`
like `method` variable? In this case, we can compare values using an '=='
instead of using postParameterLocation().equalsIgnoreCase().
```java
public enum PostParameterLocation {
// query_string, json_body, post_body
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]