You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2019/09/18 17:44:49 UTC

[GitHub] [incubator-pinot] mayankshriv commented on a change in pull request #4602: First pass of GROUP BY with ORDER BY support

mayankshriv commented on a change in pull request #4602: First pass of GROUP BY with ORDER BY support
URL: https://github.com/apache/incubator-pinot/pull/4602#discussion_r325804508
 
 

 ##########
 File path: pinot-core/src/main/java/org/apache/pinot/core/query/reduce/BrokerReduceService.java
 ##########
 @@ -204,18 +215,25 @@ public BrokerResponseNative reduceOnDataTable(@Nonnull BrokerRequest brokerReque
     }
 
     // Parse the option from request whether to preserve the type
-    String preserveTypeString = (brokerRequest.getQueryOptions() == null) ? "false" : brokerRequest.getQueryOptions()
-        .getOrDefault(CommonConstants.Broker.Request.QueryOptionKey.PRESERVE_TYPE, "false");
+    Map<String, String> queryOptions = brokerRequest.getQueryOptions();
+    String preserveTypeString =
+        (queryOptions == null) ? "false" : queryOptions.getOrDefault(QueryOptionKey.PRESERVE_TYPE, "false");
     boolean preserveType = Boolean.valueOf(preserveTypeString);
 
     if (dataTableMap.isEmpty()) {
-      // For empty data table map, construct empty result using the cached data schema.
-
-      // This will only happen to selection query.
+      // even though results empty, set columns for these operations
       if (cachedDataSchema != null) {
-        List<String> selectionColumns = SelectionOperatorUtils
-            .getSelectionColumns(brokerRequest.getSelections().getSelectionColumns(), cachedDataSchema);
-        brokerResponseNative.setSelectionResults(new SelectionResults(selectionColumns, new ArrayList<>(0)));
+        if (brokerRequest.isSetSelections()) {
+          List<String> selectionColumns =
+              SelectionOperatorUtils.getSelectionColumns(brokerRequest.getSelections().getSelectionColumns(),
+                  cachedDataSchema);
+          brokerResponseNative.setSelectionResults(new SelectionResults(selectionColumns, new ArrayList<>(0)));
+        } else if (brokerRequest.isSetGroupBy() && queryOptions != null && SQL.equalsIgnoreCase(
+            queryOptions.get(QueryOptionKey.GROUP_BY_MODE)) && SQL.equalsIgnoreCase(
+            queryOptions.get(QueryOptionKey.RESPONSE_FORMAT))) {
 
 Review comment:
   Is RESPONSE_FORMAT something that user specifies? If so, are we support query type SQL and response type PQL, and other such combinations? Not sure how that would useful, why not just dictate response based on query type (in which case we don't need this extra option)?

----------------------------------------------------------------
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

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org