RevolutionAnalytics / ravro

9 stars 11 forks source link

trouble on union with array/null case #6

Open skamkar opened 8 years ago

skamkar commented 8 years ago

Greetings!

When leveraging the union type for an array or null data, the read.avro routine fails. For reference, with the supplied test json and schema files (small_toy.zip), the avro java toolkit can successfully write an avro data file (fromjson), as well as write a json file from the created avro data file (tojson).

The issue appears to occur during the parse_avro.array call, which attempts to set schema_data. A debugger snapshot has been provided as well. It attempts to reference a nested array (schema) from a single atomic list (via "schema$").

This issue, if resolved, may also solve the issue found in a similar but larger test case (medium_toy.zip).

Thanks again, Sean

medium_toy.zip small_toy.zip screen shot 2016-01-28 at 11 21 09 am

skamkar commented 8 years ago

Also, the medium_toy.zip generates the following error:

Error in names(xj) <- paste0(xjname, ".", names(xj)) : 'names' attribute [1] must be the same length as the vector [0]

jamiefolson commented 8 years ago

Yeah, because of R's type system, we translate "null" into NA for compatibility with the primitive Avro types, but it causes problems for compound types. We need to convert "null" in those instances into R's NULL. I'll look into it, but it might be a little while before it happens.

Jamie Olson

On Thu, Jan 28, 2016 at 5:36 PM, skamkar notifications@github.com wrote:

Also, the medium_toy.zip generates the following error:

Error in names(xj) <- paste0(xjname, ".", names(xj)) : 'names' attribute [1] must be the same length as the vector [0]

— Reply to this email directly or view it on GitHub https://github.com/RevolutionAnalytics/ravro/issues/6#issuecomment-176481142 .

dkincaid commented 7 years ago

Could anyone provide a hint for how to fix this one? It's biting me right now and is blocking me from proceeding on a project. I'm happy to try to fix it, but a hint in the right direction would help.

To be clear I'm referring to the original problem the issue was created for (unions of null and array). Not the problem with the medium_toy.zip.