imay commented on a change in pull request #1454: Fix parquet load bug 
URL: https://github.com/apache/incubator-doris/pull/1454#discussion_r302096240
 
 

 ##########
 File path: be/src/exec/parquet_reader.cpp
 ##########
 @@ -47,38 +47,45 @@ ParquetReaderWrap::~ParquetReaderWrap() {
 }
 
 Status ParquetReaderWrap::init_parquet_reader(const 
std::vector<SlotDescriptor*>& tuple_slot_descs) {
-    // new file reader for parquet file
-    _reader.reset(new parquet::arrow::FileReader(arrow::default_memory_pool(),
-            std::move(parquet::ParquetFileReader::Open(_parquet, 
_properties))));
-
-    _file_metadata = _reader->parquet_reader()->metadata();
-    // initial members
-    _total_groups = _file_metadata->num_row_groups();
-    _rows_of_group = _file_metadata->RowGroup(0)->num_rows();
+    try {
+        // new file reader for parquet file
+        _reader.reset(new 
parquet::arrow::FileReader(arrow::default_memory_pool(),
+                std::move(parquet::ParquetFileReader::Open(_parquet, 
_properties))));
 
-    // map
-    const parquet::SchemaDescriptor* schemaDescriptor = 
_file_metadata->schema();
-    for (int i = 0; i < _file_metadata->num_columns(); ++i) {
-        // Get the Column Reader for the boolean column
-        _map_column.insert(std::pair<std::string, 
int>(schemaDescriptor->Column(i)->name(), i));
-    }
+        _file_metadata = _reader->parquet_reader()->metadata();
+        // initial members
+        _total_groups = _file_metadata->num_row_groups();
+        _rows_of_group = _file_metadata->RowGroup(0)->num_rows();
 
-    if (_current_line_of_group == 0) {// the first read
-        RETURN_IF_ERROR(column_indices(tuple_slot_descs));
-        // read batch
-        _reader->GetRecordBatchReader({_current_group}, _parquet_column_ids, 
&_rb_batch);
-        arrow::Status status = _rb_batch->ReadNext(&_batch);
-        if (!status.ok()) {
-            LOG(WARNING) << "The first read record. " << status.ToString();
-            throw Status::InternalError(status.ToString());
+        // map
+        const parquet::SchemaDescriptor *schemaDescriptor = 
_file_metadata->schema();
+        for (int i = 0; i < _file_metadata->num_columns(); ++i) {
+            // Get the Column Reader for the boolean column
+            _map_column.insert(std::pair<std::string, 
int>(schemaDescriptor->Column(i)->name(), i));
 
 Review comment:
   ```suggestion
               _map_column.emplace(schemaDescriptor->Column(i)->name(), i);
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to