kou commented on code in PR #37301:
URL: https://github.com/apache/arrow/pull/37301#discussion_r1302178475


##########
docs/source/cpp/json.rst:
##########
@@ -58,9 +58,8 @@ the output table.
 
       // Instantiate TableReader from input stream and options
       std::shared_ptr<arrow::json::TableReader> reader;

Review Comment:
   We need to update `arrow::json::TableReader::Read()` too:
   
   ```cpp
   {
       // ...
       arrow::MemoryPool* pool = default_memory_pool();
       std::shared_ptr<arrow::io::InputStream> input = ...;
   
       auto read_options = arrow::json::ReadOptions::Defaults();
       auto parse_options = arrow::json::ParseOptions::Defaults();
   
       // Instantiate TableReader from input stream and options
       auto maybe_reader = arrow::json::TableReader::Make(pool, input, 
read_options, parse_options);
       if (!maybe_reader.ok()) {
           // Handle TableReader instantiation error...
       }
       auto reader = *maybe_reader;
   
       // Read table from JSON file
       auto maybe_table = reader->Read();
       if (!maybe_table.ok()) {
           // Handle JSON read error
           // (for example a JSON syntax error or failed type conversion)
       }
       auto table = *maybe_table;
   }
   ```
   
   Points:
   
   * We can remove `arrow::Status st;`
   * We need to extract `reader` from `maybe_reader`
   * We need to use `arrow::Result<std::shared_ptr<arrow::Table>> 
arrow::json::TableReader::Read()`



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