Skip to content

Commit

Permalink
fix: support returning rows larger than 10MB. (databendlabs#17344)
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun authored Jan 21, 2025
1 parent 625e31a commit 7af6bf8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/query/service/src/servers/http/v1/query/page_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ impl PageManager {
i += 1;
} else {
*remain_size = 0;
if res.is_empty() && i == 0 {
i += 1
}
}
}
res.extend_from_slice(&rows[..i]);
Expand All @@ -163,7 +166,11 @@ impl PageManager {
remain_size -= size;
remain_rows -= 1;
} else {
self.row_buffer.push_front(row);
if res.is_empty() {
res.push(row);
} else {
self.row_buffer.push_front(row);
}
remain_size = 0;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1
1
"/v1/query/09_004/final"
12 changes: 12 additions & 0 deletions tests/suites/1_stateful/09_http_handler/09_0004_large_row.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
. "$CURDIR"/../../../shell_env.sh

qid="09_004"
curl -s --header 'Content-Type: application/json' --header "X-DATABEND-QUERY-ID: $qid" --request POST '127.0.0.1:8000/v1/query/' \
--data-raw $'{"sql": "select json_array_agg(json_object(\'num\',number)), (number % 2) as s from numbers(2000000) group by s;", "pagination": { "wait_time_secs": 5}}' \
-u root: | jq '.data | length'

curl -s --header 'Content-Type: application/json' "127.0.0.1:8000/v1/query/$qid/page/1" \
-u root: | jq '(.data | length), .next_uri'

0 comments on commit 7af6bf8

Please sign in to comment.