Skip to content

Commit f5df0a9

Browse files
cosmo0920edsiper
authored andcommitted
aws: compression: arrow: Set up proper block size
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent 3152192 commit f5df0a9

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/aws/compression/arrow/compress.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
#include <fluent-bit/flb_mem.h>
1616
#include <inttypes.h>
1717

18+
static int choose_block_size(size_t size)
19+
{
20+
int block_size = 8 * 1024 * 1024;
21+
22+
while ((size_t) block_size <= size) {
23+
block_size *= 2;
24+
if (block_size > 64 * 1024 * 1024) {
25+
return 64 * 1024 * 1024;
26+
}
27+
}
28+
29+
return block_size;
30+
}
31+
1832
/*
1933
* GArrowTable is the central structure that represents "table" (a.k.a.
2034
* data frame).
@@ -46,6 +60,10 @@ static GArrowTable* parse_json(uint8_t *json, int size)
4660
return NULL;
4761
}
4862

63+
g_object_set(options,
64+
"block-size", choose_block_size(size),
65+
NULL);
66+
4967
reader = garrow_json_reader_new(GARROW_INPUT_STREAM(input), options, &error);
5068
if (reader == NULL) {
5169
g_error_free(error);

0 commit comments

Comments
 (0)