[ https://issues.apache.org/jira/browse/PARQUET-1169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16279578#comment-16279578 ]
Wes McKinney commented on PARQUET-1169: --------------------------------------- You aren't checking the status codes for some of the Arrow functions. Try using a macro similar to {{ABORT_NOT_OK}} (but prints the error message to {{std::cout}}) to see the error message: https://github.com/apache/arrow/blob/fc4e2c36d2c56a8bd5d1ab17eeb406826924d3e5/cpp/src/arrow/test-util.h#L68 > Segment fault when using NextBatch of parquet::arrow::ColumnReader in > parquet-cpp > --------------------------------------------------------------------------------- > > Key: PARQUET-1169 > URL: https://issues.apache.org/jira/browse/PARQUET-1169 > Project: Parquet > Issue Type: Bug > Components: parquet-cpp > Reporter: Fang Jian > > When I running the below code, I consistently get segment fault, not sure > whether this is a bug or I did something wrong. Anyone here could help me > take a look? > {code:c++} > #include <iostream> > #include <string> > #include "arrow/array.h" > #include "arrow/io/file.h" > #include "parquet/arrow/reader.h" > using arrow::Array; > using arrow::default_memory_pool; > using arrow::io::FileMode; > using arrow::io::MemoryMappedFile; > using parquet::arrow::ColumnReader; > using parquet::arrow::FileReader; > using parquet::arrow::OpenFile; > int main(int argc, char** argv) { > if (argc > 1) { > std::string file_name = argv[1]; > std::shared_ptr<MemoryMappedFile> file; > MemoryMappedFile::Open(file_name, FileMode::READ, &file); > std::unique_ptr<FileReader> file_reader; > OpenFile(file, default_memory_pool(), &file_reader); > std::unique_ptr<ColumnReader> column_reader; > file_reader->GetColumn(0, &column_reader); > std::shared_ptr<Array> array1; > column_reader->NextBatch(1, &array1); > std::cout << "length " << array1->length() << std::endl; > std::shared_ptr<Array> array2; > // raise segment fault > column_reader->NextBatch(1, &array2); > std::cout << "length " << array2->length() << std::endl; > } > return 0; > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)