You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Jonathan Keane (Jira)" <ji...@apache.org> on 2022/06/30 16:35:00 UTC

[jira] [Updated] (ARROW-15803) [R] Empty JSON object parsed as corrupt data frame

     [ https://issues.apache.org/jira/browse/ARROW-15803?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Keane updated ARROW-15803:
-----------------------------------
    Fix Version/s:     (was: 9.0.0)

> [R] Empty JSON object parsed as corrupt data frame
> --------------------------------------------------
>
>                 Key: ARROW-15803
>                 URL: https://issues.apache.org/jira/browse/ARROW-15803
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: R
>    Affects Versions: 7.0.0
>            Reporter: Will Jones
>            Priority: Major
>
> If you have a JSON object field that is always empty, it seems to be not handled well, whether or not a schema is provided that tells Arrow what should be in that object.
> {code:r}
> library(arrow)
> #> 
> #> Attaching package: 'arrow'
> #> The following object is masked from 'package:utils':
> #> 
> #>     timestamp
> json_val <- '{
>   "rows": [
>     {"empty": {} },
>     {"empty": {} },
>     {"empty": {} }
>   ]
> }'
> # Remove newlines
> json_val <- gsub("\n", "", json_val)
> json_file <- tempfile()
> writeLines(json_val, json_file)
> schema <- schema(field("rows", list_of(struct(empty = struct(y = int32())))))
> raw <- read_json_arrow(json_file, schema=schema)
> raw$rows$empty
> #> Error: Corrupt x: no names
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)