usql
usql copied to clipboard
AvroExtractor makes new row for each column
I am wondering why the AvroExtractor is made to make a new row for each new column, and not a new row after all columns for that object have been read. See my comment in code snippet below, from AvroExtractor.cs
while (fileReader.HasNext())
{
var avroRecord = fileReader.Next();
foreach (var column in output.Schema)
{
if (avroRecord[column.Name] != null)
{
output.Set(column.Name, avroRecord[column.Name]);
}
else
{
output.Set<object>(column.Name, null);
}
yield return output.AsReadOnly(); // Why here, and not after the foreach loop?
}
}
Consequence is that the output looks like this:
City Country Phone
NY
US
345
QD
CH
948
instead of
City Country Phone
NY US 345
QD CH 948
There's probably a purpose with the current way, but I don't quite understand it - so if someone could enlighten me, it would be greatly appreciated!
I made a pull request on this
Adding @flomader. I guess that was an oversight.
That's a bug. Thanks for finding and fixing.