[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-15 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314383656
 
 

 ##
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/response/broker/OrderedGroupByResults.java
 ##
 @@ -28,39 +28,26 @@
 /**
  * This class holds the results of group by order by query which is set into 
the {@link BrokerResponseNative}
  */
-@JsonPropertyOrder({"orderBy", "groupByKeys", "aggregationResults"})
-public class GroupByOrderByResults {
-  private List _orderBy;
-  private List _groupByKeys;
+@JsonPropertyOrder({"groupBy", "aggregationResults"})
+public class OrderedGroupByResults {
 
 Review comment:
   Does not.. but we will have continue to keep the current group by behavior 
right? 


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-15 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314382962
 
 

 ##
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java
 ##
 @@ -64,7 +64,7 @@
 
   private SelectionResults _selectionResults;
   private List _aggregationResults;
-  private GroupByOrderByResults _groupByOrderByResults;
+  private OrderedGroupByResults _orderedGroupByResults;
 
 Review comment:
   There's 2 options in the existing structure:
   1. Selection results - this has only selection columns
   2. List - these are split up as group by columns + 1 
aggregation, per aggregation
   
   Potentially we can get rid of List when we completely 
remove the existing group by behavior


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-14 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314142218
 
 

 ##
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/GroupByRecord.java
 ##
 @@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.operator;
+
+import com.google.common.base.Joiner;
+import javax.annotation.Nonnull;
+import org.apache.pinot.common.utils.EqualityUtils;
+import org.apache.pinot.core.query.aggregation.function.AggregationFunction;
+
+
+/**
+ * The GroupByRecord class represents one record of a group by 
query result
+ */
+public class GroupByRecord {
+  private String[] _groupByKey;
+  private Object[] _aggregationResults;
+  // TODO: could just 1 array be used to store both keys and values?
+
+  private static String SEPARATOR = "\t";
 
 Review comment:
   Done


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-14 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314142099
 
 

 ##
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/IntermediateResultsBlock.java
 ##
 @@ -46,11 +47,13 @@
  */
 public class IntermediateResultsBlock implements Block {
   private DataSchema _selectionDataSchema;
+  private DataSchema _orderByDataSchema;
 
 Review comment:
   Kept just 1 DataSchema field


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-14 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314142167
 
 

 ##
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/response/broker/BrokerResponseNative.java
 ##
 @@ -64,6 +64,7 @@
 
   private SelectionResults _selectionResults;
   private List _aggregationResults;
+  private GroupByOrderByResults _groupByOrderByResults;
 
 Review comment:
   Renamed across the board


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-14 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314132252
 
 

 ##
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/GroupByRecord.java
 ##
 @@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.operator;
+
+import com.google.common.base.Joiner;
+import javax.annotation.Nonnull;
+import org.apache.pinot.common.utils.EqualityUtils;
+import org.apache.pinot.core.query.aggregation.function.AggregationFunction;
+
+
+/**
+ * The GroupByRecord class represents one record of a group by 
query result
+ */
+public class GroupByRecord {
+  private String[] _groupByKey;
+  private Object[] _aggregationResults;
+  // TODO: could just 1 array be used to store both keys and values?
+
+  private static String SEPARATOR = "\t";
+
+  public GroupByRecord(@Nonnull String stringKey, @Nonnull Object[] 
aggregationResults) {
+_groupByKey = stringKey.split(SEPARATOR);
+_aggregationResults = aggregationResults;
+  }
+
+  @Nonnull
+  public String[] getGroupByKey() {
+return _groupByKey;
+  }
+
+  @Nonnull
+  public Object[] getAggregationResults() {
+return _aggregationResults;
+  }
+
+  /**
+   * Merges the given aggregation results into the existing 
GroupByRecord
+   */
+  public void merge(Object[] resultToMerge, AggregationFunction[] 
aggregationFunctions, int numAggregationFunctions) {
+for (int i = 0; i < numAggregationFunctions; i++) {
+  _aggregationResults[i] = 
aggregationFunctions[i].merge(_aggregationResults[i], resultToMerge[i]);
+}
+  }
+
+  /**
+   * Given an array of group by keys, constructs the concatenated string 
equivalent key
+   */
+  public static String constructGroupByKey(String[] groupByKeys) {
+return Joiner.on(SEPARATOR).join(groupByKeys);
+  }
+
+  @Override
+  public boolean equals(Object o) {
 
 Review comment:
   it should not be invoked during query processing. Will keep that in mind if 
that changes.


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:
us...@infra.apache.org


With regards,
Apache Git Services

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



[GitHub] [incubator-pinot] npawar commented on a change in pull request #4527: Group by with order by

2019-08-14 Thread GitBox
npawar commented on a change in pull request #4527: Group by with order by
URL: https://github.com/apache/incubator-pinot/pull/4527#discussion_r314053355
 
 

 ##
 File path: 
pinot-common/src/main/java/org/apache/pinot/common/response/broker/GroupByOrderByResults.java
 ##
 @@ -0,0 +1,75 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.common.response.broker;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * This class holds the results of group by order by query which is set into 
the {@link BrokerResponseNative}
+ */
+@JsonPropertyOrder({"orderBy", "groupByKeys", "aggregationResults"})
+public class GroupByOrderByResults {
+  private List _orderBy;
+  private List _groupByKeys;
+  private List _aggregationResults;
+
+  @JsonCreator
+  public GroupByOrderByResults(@JsonProperty("orderBy") List orderBy,
 
 Review comment:
   that's right, we don't need it. Will remove it. Instead, we might have to 
include the group by columns and aggregations. I dont think those are returned 
right now


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:
us...@infra.apache.org


With regards,
Apache Git Services

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