forked from rapidsai/cudf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support "values" orient (array of arrays) in Nested JSON reader (rapi…
…dsai#12498) Legacy GPU JSON reader can read "values" orient data in JSON string (only JSON lines). With this PR change, Nested JSON reader can also reader "values" orient data for both JSON lines and non-line JSON string. Examples: ``` import cudf json="[[1, 2, 3], [4, 5], [7, 8, 9]]" cudf.read_json(json, engine="cudf_experimental") 0 1 2 0 1 2 3 1 4 5 <NA> 2 7 8 9 json="[1, 2, 3]\n [4, 5, null]\n [7, 8, [9]]" cudf.read_json(json, engine="cudf_experimental", lines=True) 0 1 2 0 1 2 None 1 4 5 None 2 7 8 [9] ``` Note that pandas passes "values" data but with `orient="records"` argument, but it is parsed as "values". Similar support is added here too. Passing values with `orient="records"` will still work). closes rapidsai#12446 #### Changes in this PR: - Added a lambda `is_non_list_parent` - added extra condition to skip array (level2 list) nodes. - New algorithm to generate `list_indices` within each row. - Use it for hashing. - Use it for column names. (but generated again). **Changes to tests:** - added row orient experiemental reader testing param - datetime, duration needs to be wrapped with double quotes if it has whitespace or colon. (limitation of nested json reader, also to be compliant with JSON specification). Authors: - Karthikeyan (https://github.com/karthikeyann) Approvers: - Vukasin Milovanovic (https://github.com/vuule) - Elias Stehle (https://github.com/elstehle) - GALI PREM SAGAR (https://github.com/galipremsagar) URL: rapidsai#12498
- Loading branch information
1 parent
c14b3c8
commit cc37c72
Showing
7 changed files
with
473 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.