ihuzenko commented on a change in pull request #1608: DRILL-6960: Auto Limit
Wrapping should not apply to non-select query
URL: https://github.com/apache/drill/pull/1608#discussion_r252707797
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
##########
@@ -83,10 +83,14 @@ public QueryResult submitQueryJSON(QueryWrapper query)
throws Exception {
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public Viewable submitQuery(@FormParam("query") String query,
- @FormParam("queryType") String queryType) throws
Exception {
+ @FormParam("queryType") String queryType,
+ @FormParam("autoLimit") String autoLimit
+ ) throws Exception {
try {
final String trimmedQueryString =
CharMatcher.is(';').trimTrailingFrom(query.trim());
- final QueryResult result = submitQueryJSON(new
QueryWrapper(trimmedQueryString, queryType));
+ //Extract option of AutoLimit
+ String autoLimitValue = (autoLimit != null &&
autoLimit.matches("[0-9]+")) ? autoLimit : "";
Review comment:
To avoid double pattern check (here and in ```QueryWrapper```'s
constructor), simply pass ```autoLimitValue``` to constructor of
```QueryWrapper``` and then within constructor set :
```java
this.autoLimitRowCount = autoLimit != null && autoLimit.matches("[0-9]+") ?
new Integer(autoLimit) : null;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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