Skip to content

Commit

Permalink
Misc fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand committed Feb 8, 2023
1 parent 1a83941 commit 7b508db
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private <T> ResponseListener<T> fallBackListener(
return new ResponseListener<T>() {
@Override
public void onResponse(T response) {
LOG.error("[{}] Request is handled by new SQL query engine",
LOG.info("[{}] Request is handled by new SQL query engine",
QueryContext.getRequestId());
next.onResponse(response);
}
Expand Down Expand Up @@ -172,7 +172,7 @@ private ResponseListener<QueryResponse> createQueryResponseListener(
@Override
public void onResponse(QueryResponse response) {
sendResponse(channel, OK,
formatter.format(new QueryResult(response.getSchema(), response.getResults())));
formatter.format(new QueryResult(response.getSchema(), response.getResults(), response.getCursor())));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
public class OpenSearchScrollRequest implements OpenSearchRequest {

/** Default scroll context timeout in minutes. */
public static final TimeValue DEFAULT_SCROLL_TIMEOUT = TimeValue.timeValueMinutes(1L);
public static final TimeValue DEFAULT_SCROLL_TIMEOUT = TimeValue.timeValueMinutes(100L);

/**
* {@link OpenSearchRequest.IndexName}.
Expand Down Expand Up @@ -86,6 +86,7 @@ public OpenSearchResponse search(Function<SearchRequest, SearchResponse> searchA
} else {
openSearchResponse = searchAction.apply(searchRequest());
}

setScrollId(openSearchResponse.getScrollId());

return new OpenSearchResponse(openSearchResponse, exprValueFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public OpenSearchResponse(SearchHits hits, OpenSearchExprValueFactory exprValueF
*/
public boolean isEmpty() {
return (hits.getHits() == null) || (hits.getHits().length == 0) && aggregations == null;
// TODO TBD ^ ^
}

public boolean isAggregationResponse() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public OpenSearchResponse search(Function<SearchRequest, SearchResponse> searchA
Function<SearchScrollRequest, SearchResponse> scrollAction) {
SearchResponse openSearchResponse;

openSearchResponse = scrollAction.apply(new SearchScrollRequest(initialScrollId));
openSearchResponse = scrollAction.apply(new SearchScrollRequest(initialScrollId));
responseScrollId = openSearchResponse.getScrollId();

return new OpenSearchResponse(openSearchResponse, exprValueFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public InitialPageRequestBuilder(OpenSearchRequest.IndexName indexName, Settings
this.indexName = indexName;
this.sourceBuilder = new SearchSourceBuilder();
this.exprValueFactory = exprValueFactory;
this.querySize = settings.getSettingValue(Settings.Key.QUERY_SIZE_LIMIT);
this.querySize = settings.getSettingValue(Settings.Key.QUERY_SIZE_LIMIT);//TODO fetch_size
sourceBuilder.from(0);
sourceBuilder.size(querySize);
sourceBuilder.timeout(DEFAULT_QUERY_TIMEOUT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void open() {
OpenSearchResponse response = client.search(request);
if (!response.isEmpty()) {
iterator = response.iterator();
}
} // TODO else - last page is empty -
}

@Override
Expand Down

0 comments on commit 7b508db

Please sign in to comment.