FeatherDotNet icon indicating copy to clipboard operation
FeatherDotNet copied to clipboard

C# -> R Files seem invalid

Open abbotware opened this issue 4 years ago • 0 comments

It seems the feather file produced by the library is not loadable in R. I can create a similar file in R and it loads ok in C#.

C# Create Feather

using (var writer = new FeatherWriter("C:\\temp\\simple.cs.feather", WriteMode.Eager))
{
  var a = new string[] { "a" };
  var b = new string[] { "b" };
  writer.AddColumn("a", a);
  writer.AddColumn("b", b);
 }

R Load Feather

t <- read_feather("C:\\temp\\simple.cs.feather")
df <- data.frame(t)

produces the following error:

Error in Table__to_dataframe(x, use_threads = option_use_threads()) : 
  embedded nul in string: '\0'

I suspect there is an alignment / padding issue

if i create the file in R:

library(arrow)
simple <- data.frame("a" = "a", "b"= "b", stringsAsFactors = FALSE)
write_feather(simple, "C:\\temp\\simple.r.feather")

I can load it with no problems in C# and I noticed the data offset for the second column is 24 in the R generated file and only 18 in C# generated file

abbotware avatar Sep 12 '19 16:09 abbotware