taepper commented on code in PR #51038:
URL: https://github.com/apache/arrow/pull/51038#discussion_r4194443496


##########
cpp/src/arrow/json/parser.cc:
##########
@@ -662,71 +657,58 @@ class HandlerBase : public BlockParser,
     return builder_set_.Cast<kind>(builder);
   }
 
-  /// Accessor for a stored error Status
-  Status Error() { return status_; }
-
-  /// \defgroup rapidjson-handler-interface functions expected by rj::Reader
-  ///
-  /// bool Key(const char* data, rj::SizeType size, ...) is omitted since
-  /// the behavior varies greatly between UnexpectedFieldBehaviors
-  ///
-  /// @{
-  bool Null() {
-    status_ = builder_set_.AppendNull(builder_stack_.back(), field_index_, 
builder_);
-    return status_.ok();
+  Status Null() {
+    return builder_set_.AppendNull(builder_stack_.back(), field_index_, 
builder_);

Review Comment:
   ```
   python -c "
   import io, pyarrow.json as j
   j.read_json(io.BytesIO(b'null\n'))"
   ```
   
   oh, sorry for the noise. I accidentally reused a stale RapidJSON version of 
the parser that I still had locally. After correctly rebuilding this branch's 
version it does not segfault anymore. So this actually fixed a the segfault in 
the prior code
   
   
   <details>
   <summary>this is the stacktrace for arrow 25.0.1</summary>
   
   ```
   Thread 18 "python" received signal SIGSEGV, Segmentation fault.
   #0  arrow::json::HandlerBase::Null()                         
cpp/src/arrow/json/parser.cc:675
   #1  rapidjson::GenericReader<...>::ParseNull<332, ..., Handler<InferType>>   
rapidjson/reader.h:710
   #2  rapidjson::GenericReader<...>::ParseValue<...>             
rapidjson/reader.h:1394
   #3  rapidjson::GenericReader<...>::Transit<...>  (StartState --NullToken--> 
ValueState)  reader.h:1792
   #4  rapidjson::GenericReader<...>::IterativeParse<...>         
rapidjson/reader.h:1832
   #5  rapidjson::GenericReader<...>::Parse<...>                  
rapidjson/reader.h:487
   #6  arrow::json::HandlerBase::DoParse<Handler<InferType>, ...>(json_size=5)  
parser.cc:774
   #7  arrow::json::HandlerBase::DoParse<Handler<InferType>>     parser.cc:801
   #8  arrow::json::Handler<InferType>::Parse                     parser.cc:1081
   #9  arrow::json::ParseBlock                                    reader.cc:162
   #10 arrow::json::TableReaderImpl::ParseAndInsert               reader.cc:287
   #11 TableReaderImpl::Read()::<lambda>                          reader.cc:268
   ...
   ```
   
   </details>



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