You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] An unstable crash may appears when reading table from a json file. #20253
Jack Tondon:
Sorry for the late response. The problem is sporadic with default ReadOptions. As you see, arrow infer that traffic_light_id is a timestamp type, but I do sure that it's a string, and other string fields, such as camera_id, are also be infered as timestamp.
Still reproduces, needs more investigation, AI analysis below but requires verification
Still reproduces on 26.0.1 with the attached test.json: default options fail about half the time, use_threads=False fails every
time. The error is always ArrowNotImplementedError: JSON conversion to struct<...> is not supported; it never produces a table with wrong column types.
The timestamp[s] types in the message are a red herring (strings are inferred as timestamp first and widened to utf8 later). The
actual cause is in cross-block type promotion. When a block's conversion fails, chunked_builder.cc calls Promote() on the leaf
builder. For a column whose type was fixed as null by an earlier block, Promote() falls through to Infer(), which returns a
struct or list type if the value in the new block is an object or array. That type is then passed to MakeConverter(), which has no
struct or list case and returns NotImplemented. Which block fixes the type first depends on block boundaries and thread scheduling,
hence the sporadic behaviour.
Fix needed: a null-typed leaf builder promoted to a nested type should get a nested chunked builder instead of a leaf converter.
Regression test: a column that is null in block 1 and an object in block 2. Retitled to reflect this.
Activity
asfimport commentedon May 19, 2022
Antoine Pitrou / @pitrou:
Hmm... are you complaining about the crash or about the error?
As the name implies, the
ValueOrDiemethod will abort the process if theResult<T>instance contains an error instead of a successful result. This is also explained in the method documentation:https://arrow.apache.org/docs/cpp/api/support.html?highlight=valueordie#_CPPv4NKR5arrow6Result10ValueOrDieEv
asfimport commentedon May 19, 2022
Antoine Pitrou / @pitrou:
The file does succeed loading in PyArrow here, though. Or is the problem you see sporadic?
asfimport commentedon May 19, 2022
Antoine Pitrou / @pitrou:
Ok, this can be reproduced in PyArrow when the block size is a bit too small.
With a much too small block size, one gets the expected error:
With a large enough block size, reading the JSON file succeeds:
But with a block size that's somewhat in-between, reading the JSON file fails with that unexpected unsupported conversion error:
@bkietz Is this something that you know might happen?
asfimport commentedon May 20, 2022
Jack Tondon:
Sorry for the late response. The problem is sporadic with default ReadOptions. As you see, arrow infer that
traffic_light_idis a timestamp type, but I do sure that it's a string, and other string fields, such ascamera_id, are also be infered as timestamp.asfimport commentedon May 20, 2022
Jack Tondon:
Seems with
use_threads=false, the problem reappears stablythisisnic commentedon Nov 9, 2026
Still reproduces, needs more investigation, AI analysis below but requires verification
Still reproduces on 26.0.1 with the attached
test.json: default options fail about half the time,use_threads=Falsefails everytime. The error is always
ArrowNotImplementedError: JSON conversion to struct<...> is not supported; it never produces a table with wrong column types.The
timestamp[s]types in the message are a red herring (strings are inferred as timestamp first and widened to utf8 later). Theactual cause is in cross-block type promotion. When a block's conversion fails,
chunked_builder.cccallsPromote()on the leafbuilder. For a column whose type was fixed as null by an earlier block,
Promote()falls through toInfer(), which returns astruct or list type if the value in the new block is an object or array. That type is then passed to
MakeConverter(), which has nostruct or list case and returns NotImplemented. Which block fixes the type first depends on block boundaries and thread scheduling,
hence the sporadic behaviour.
Fix needed: a null-typed leaf builder promoted to a nested type should get a nested chunked builder instead of a leaf converter.
Regression test: a column that is null in block 1 and an object in block 2. Retitled to reflect this.