mapleFU commented on code in PR #37003:
URL: https://github.com/apache/arrow/pull/37003#discussion_r1282581225
##########
cpp/src/parquet/file_reader.h:
##########
@@ -58,6 +59,11 @@ class PARQUET_EXPORT RowGroupReader {
// column. Ownership is shared with the RowGroupReader.
std::shared_ptr<ColumnReader> Column(int i);
+ // Construct a RecordReader for the indicated row group-relative column i.
+ // Ownership is shared with the RowGroupReader.
+ std::shared_ptr<internal::RecordReader> RecordReader(
Review Comment:
Emm I'm ok with the logic here, but is it ok to expose `internal::` logic?
##########
cpp/src/parquet/file_reader.cc:
##########
@@ -82,6 +82,28 @@ std::shared_ptr<ColumnReader> RowGroupReader::Column(int i) {
const_cast<ReaderProperties*>(contents_->properties())->memory_pool());
}
+std::shared_ptr<internal::RecordReader> RowGroupReader::RecordReader(
+ int i, bool read_dictionary, bool read_dense_for_nullable) {
+ if (i >= metadata()->num_columns()) {
+ std::stringstream ss;
+ ss << "Trying to read column index " << i << " but row group metadata has
only "
+ << metadata()->num_columns() << " columns";
+ throw ParquetException(ss.str());
+ }
+ const ColumnDescriptor* descr = metadata()->schema()->Column(i);
+
+ std::unique_ptr<PageReader> page_reader = contents_->GetColumnPageReader(i);
+
+ internal::LevelInfo level_info =
internal::LevelInfo::ComputeLevelInfo(descr);
+
+ auto reader = internal::RecordReader::Make(
+ descr, level_info,
+ const_cast<ReaderProperties*>(contents_->properties())->memory_pool(),
Review Comment:
Is this `const_cast` neccessary?
##########
cpp/src/parquet/file_reader.h:
##########
@@ -22,6 +22,7 @@
#include <string>
#include <vector>
+#include "parquet/column_reader.h"
Review Comment:
This should after `#include "arrow/util/type_fwd.h"` ?
--
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]