You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Will Jones (Jira)" <ji...@apache.org> on 2022/02/28 16:49:00 UTC

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

Will Jones created ARROW-15803:
----------------------------------

             Summary: [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
    Affects Versions: 7.0.0
            Reporter: Will Jones
             Fix For: 8.0.0


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.1#820001)