alexandre-bry opened a new issue, #49260:
URL: https://github.com/apache/arrow/issues/49260

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   I looked at the documentation there to figure out how to open a Parquet file 
with C++: https://arrow.apache.org/docs/cpp/parquet.html#filereader
   In the example, we have this:
   
   ```
   // #include "arrow/io/api.h"
   // #include "parquet/arrow/reader.h"
   
   arrow::MemoryPool* pool = arrow::default_memory_pool();
   std::shared_ptr<arrow::io::RandomAccessFile> input;
   ARROW_ASSIGN_OR_RAISE(input, arrow::io::ReadableFile::Open(path_to_file));
   
   // Open Parquet file reader
   std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
   ARROW_ASSIGN_OR_RAISE(arrow_reader, parquet::arrow::OpenFile(input, pool));
   
   // Read entire file as a single Arrow table
   std::shared_ptr<arrow::Table> table;
   ARROW_RETURN_NOT_OK(arrow_reader->ReadTable(&table));
   ```
   
   So I tried this code (by uncommenting the imports) and it compiles but the 
table that we get does not seem correct, because any of the methods of tables 
does not work and gives errors like this:
   
   ```cpp
   /path/to/test.cpp: In function 'arrow::Status open_parquet(std::string&)':
   /path/to/test.cpp:28:26: error: invalid use of incomplete type 'using 
std::__shared_ptr_access<arrow::Table, __gnu_cxx::_S_atomic, false, 
false>::element_type = class arrow::Table' {aka 'class arrow::Table'}
      28 |     auto num_rows = table->num_rows();
         |                          ^~
   In file included from /usr/include/arrow/io/type_fwd.h:20,
                    from /usr/include/arrow/io/interfaces.h:26,
                    from /usr/include/arrow/io/concurrency.h:22,
                    from /usr/include/arrow/io/buffered.h:26,
                    from /usr/include/arrow/io/api.h:20,
                    from /path/to/test.cpp:7:
   /usr/include/arrow/type_fwd.h:86:7: note: forward declaration of 'using 
std::__shared_ptr_access<arrow::Table, __gnu_cxx::_S_atomic, false, 
false>::element_type = class arrow::Table' {aka 'class arrow::Table'}
      86 | class Table;
         |       ^~~~~
   ```
   
   But then by replacing `#include "arrow/io/api.h"` with:
   
   ```cpp
   #include "arrow/api.h"
   #include "arrow/io/file.h"
   ```
   
   it works correctly.
   
   ### Component(s)
   
   C++


-- 
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]

Reply via email to