kou commented on code in PR #51277:
URL: https://github.com/apache/arrow/pull/51277#discussion_r4090497576
##########
c_glib/parquet-glib/arrow-file-reader.cpp:
##########
@@ -25,25 +25,191 @@
#include <parquet/file_reader.h>
+namespace {
+ GParquetArrowFileReader *
+ open_reader_with_properties(std::shared_ptr<arrow::io::RandomAccessFile>
source,
+ GArrowSeekableInputStream *source_object,
+ GParquetReaderProperties *properties,
+ GError **error,
+ const char *tag)
+ {
+ auto parquet_properties = properties ?
gparquet_reader_properties_get_raw(properties)
+ :
parquet::default_reader_properties();
+ parquet::arrow::FileReaderBuilder builder;
+ if (!garrow::check(error, builder.Open(source, parquet_properties), tag)) {
+ return NULL;
+ }
+ if (parquet_properties.is_buffered_stream_enabled()) {
+ // Read-ahead would bypass the buffered stream by caching whole column
chunks.
+ auto arrow_properties = parquet::default_arrow_reader_properties();
+ arrow_properties.set_pre_buffer(false);
+ builder.properties(arrow_properties);
+ }
+ auto result = builder.Build();
+ if (!garrow::check(error, result, tag)) {
+ return NULL;
+ }
+ return
GPARQUET_ARROW_FILE_READER(g_object_new(GPARQUET_TYPE_ARROW_FILE_READER,
+ "arrow-file-reader",
+ result->release(),
+ "source",
+ source_object,
+ NULL));
Review Comment:
Could you use `gparquet_arrow_file_reader_new_raw()`?
##########
c_glib/parquet-glib/arrow-file-reader.cpp:
##########
@@ -25,25 +25,191 @@
#include <parquet/file_reader.h>
+namespace {
+ GParquetArrowFileReader *
+ open_reader_with_properties(std::shared_ptr<arrow::io::RandomAccessFile>
source,
Review Comment:
Can we remove `with_properties` and use this for
`gparquet_arrow_file_reader_new_arrow()` too?
##########
c_glib/parquet-glib/arrow-file-reader.cpp:
##########
@@ -25,25 +25,191 @@
#include <parquet/file_reader.h>
+namespace {
+ GParquetArrowFileReader *
+ open_reader_with_properties(std::shared_ptr<arrow::io::RandomAccessFile>
source,
+ GArrowSeekableInputStream *source_object,
+ GParquetReaderProperties *properties,
+ GError **error,
+ const char *tag)
+ {
+ auto parquet_properties = properties ?
gparquet_reader_properties_get_raw(properties)
+ :
parquet::default_reader_properties();
+ parquet::arrow::FileReaderBuilder builder;
+ if (!garrow::check(error, builder.Open(source, parquet_properties), tag)) {
+ return NULL;
+ }
+ if (parquet_properties.is_buffered_stream_enabled()) {
+ // Read-ahead would bypass the buffered stream by caching whole column
chunks.
+ auto arrow_properties = parquet::default_arrow_reader_properties();
+ arrow_properties.set_pre_buffer(false);
Review Comment:
Could you avoid this implicit configuration?
Could you add `parquet::ArrowReaderProperties` to
`GParquetReaderPropertiesPrivate_` so that users can set
`arrow_properties.set_pre_buffer` manually?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]