Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-15803

[R] Empty JSON object parsed as corrupt data frame

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 7.0.0
    • None
    • R
    • None

    Description

      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.

      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
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            wjones127 Will Jones
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: