gvol opened a new issue, #47417:
URL: https://github.com/apache/arrow/issues/47417
### Describe the bug, including details regarding any error messages,
version, and platform.
When I build (in debug) and run the code below I get the following assertion
firing:
```
$ ./arrow_json
/Users/iandrus/.conan2/p/b/arrow4b55108a32d91/b/src/cpp/src/arrow/json/parser.cc:540:
Check failed: (builder) == (parent.kind == Kind::kArray ?
Cast<Kind::kArray>(parent)->value_builder() :
Cast<Kind::kObject>(parent)->field_builder(field_index))
Abort trap: 6 ./arrow_json
```
Needless to say, it shouldn't abort on this, but rather fail to parse (if
it's not valid—though it seems to me that it should be valid).
```
#include <arrow/buffer.h>
#include <arrow/io/api.h>
#include <arrow/json/api.h>
#include <arrow/status.h>
#include <memory>
#include <string>
int main( void ) {
std::string json_data = R"json({
"all_nulls": [null, null, null]
})json";
auto buffer = std::make_shared<::arrow::Buffer>(
reinterpret_cast<uint8_t const *>( json_data.data() ),
json_data.size() );
auto input = std::make_shared<::arrow::io::BufferReader>( buffer );
auto reader = ::arrow::json::TableReader::Make(
::arrow::default_memory_pool(),
input,
::arrow::json::ReadOptions::Defaults(),
::arrow::json::ParseOptions::Defaults() );
if ( !reader.ok() ) {
return 1;
}
auto result = (*reader)->Read();
return result.ok() ? 0 : 1;
}
// clang++ -o ./arrow_json ./arrow_json_main.cpp -isystem
/Users/iandrus/.conan2/p/b/arrow4b55108a32d91/p/include -std=c++20 -L
/Users/iandrus/.conan2/p/b/arrow4b55108a32d91/p/lib/ -larrow
-larrow_bundled_dependencies -L
/Users/iandrus/.conan2/p/b/snapp07bbfca910b63/p/lib/ -lsnappy -L
/Users/iandrus/.conan2/p/b/zstde2aeb565ce8ea/p/lib -lzstd
-L/Users/iandrus/.conan2/p/b/zlibb749ff5e66dc6/p/lib -lz
```
Changing the json to have `[null, "hi", null]` gives a different assertion.
After some experimenting, the trouble seems to be the null in the first
position.
```
/Users/iandrus/.conan2/p/b/arrow4b55108a32d91/b/src/cpp/src/arrow/json/parser.cc:1151:
Check failed: (list_builder->value_builder()) == (builder_)
Abort trap: 6 ./arrow_json
```
### 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]