This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new ea3566f Fix the memory issue for selection query with large limit
(#7112)
ea3566f is described below
commit ea3566f9b633c067ff691be859596837235dd7bb
Author: Xiaotian (Jackie) Jiang <[email protected]>
AuthorDate: Thu Jul 1 10:38:22 2021 -0700
Fix the memory issue for selection query with large limit (#7112)
Fix the memory issue for selection query with large limit
---
.../pinot/core/query/selection/SelectionOperatorUtils.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionOperatorUtils.java
b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionOperatorUtils.java
index 84d8b85..7fd6b95 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionOperatorUtils.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionOperatorUtils.java
@@ -404,12 +404,12 @@ public class SelectionOperatorUtils {
* Reduces a collection of {@link DataTable}s to selection rows for
selection queries without <code>ORDER BY</code>.
* (Broker side)
*/
- public static List<Object[]> reduceWithoutOrdering(Collection<DataTable>
dataTables, int selectionSize) {
- List<Object[]> rows = new ArrayList<>(selectionSize);
+ public static List<Object[]> reduceWithoutOrdering(Collection<DataTable>
dataTables, int limit) {
+ List<Object[]> rows = new ArrayList<>(Math.min(limit,
SelectionOperatorUtils.MAX_ROW_HOLDER_INITIAL_CAPACITY));
for (DataTable dataTable : dataTables) {
int numRows = dataTable.getNumberOfRows();
for (int rowId = 0; rowId < numRows; rowId++) {
- if (rows.size() < selectionSize) {
+ if (rows.size() < limit) {
rows.add(extractRowFromDataTable(dataTable, rowId));
} else {
return rows;
@@ -467,7 +467,8 @@ public class SelectionOperatorUtils {
* @param selectionColumns selection columns.
* @return {@link ResultTable} object results.
*/
- public static ResultTable renderResultTableWithoutOrdering(List<Object[]>
rows, DataSchema dataSchema, List<String> selectionColumns) {
+ public static ResultTable renderResultTableWithoutOrdering(List<Object[]>
rows, DataSchema dataSchema,
+ List<String> selectionColumns) {
int numRows = rows.size();
List<Object[]> resultRows = new ArrayList<>(numRows);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]