RajaBabu15 commented on PR #55840:
URL: https://github.com/apache/arrow/pull/55840#issuecomment-7257120697

   Notes from reading the code and related work, as context for this PR.
   
   The tests hold one rule: a read split into blocks gives the same result as 
the same rows in one block. For type inference that means merging types must 
not depend on block order or grouping, `null` changes nothing, and a conflict 
stays a conflict.
   
   Inside one block `BlockParser` enforces this. Its comment in `parser.h` says 
a change of JSON kind in a column is an error. Across blocks the chunked 
builders assume the kind has not changed. `checked_cast` is a `dynamic_cast` in 
debug and a `static_cast` in release, which is why a debug build stops on a 
failed check or `std::bad_cast`, while release crashes or returns wrong values.
   
   One case goes further than the issue title. Numbers and strings reach the 
converters as the same array type, so on main (`6f040e8`) a string followed by 
a number in the next block is read as a string, while one block rejects it. A 
check on the array type cannot catch this. The parser already tags each struct 
field and list item with its JSON kind (`json_kind`), and `Kind::ForType` gives 
the kind a builder expects. I have not built or tested a check based on that.
   
   How other readers merge two different types:
   
   - Arrow CSV loosens the type along a fixed chain that ends in binary
   - arrow-rs schema inference widens int plus float to `Float64` and other 
mixed scalars to `Utf8`, turns list plus scalar into a list, and rejects object 
plus scalar
   - Spark JSON inference falls back to string
   
   The same builders had earlier crash fixes around null and missing lists 
(ARROW-12065, ARROW-13871). A list or object after only nulls still fails, 
which is GH-20253.
   
   State of this branch on a macOS arm64 debug build: the list builder check is 
in, 13 of the 29 new tests pass, and the 246 existing JSON tests pass. The 
struct builder and the converters are next. No test yet covers a conflict 
followed by valid blocks.
   


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