aloneguid / parquet-dotnet

Fully managed Apache Parquet implementation
https://aloneguid.github.io/parquet-dotnet/
MIT License
542 stars 140 forks source link

[BUG]: empty string array incorrect serialization #481

Open nd368 opened 4 months ago

nd368 commented 4 months ago

Library Version

4.23.4

OS

Windows

OS Architecture

64 bit

How to reproduce?

Actual behaviour: Empty string array serialized to a collection containing 1 NULL element

Expected behaviour: Empty string array serialized to a collection containing no elements

class Example
{
    public string[] EmptyStringArray { get; } = Array.Empty<string>();
}

[Test]
public async Task MinimalExample()
{
    var tempFile = Path.GetTempPath() + "example.parquet";
    using var fileStream = new FileStream(tempFile, FileMode.Create);

    var objectWithEmptyStringArray = new Example();
    await ParquetSerializer.SerializeAsync(new List<Example> { objectWithEmptyStringArray }, fileStream);

    fileStream.Close();
    Console.Write($"Parquet file: {tempFile}");
}

Open generated file in any parquet file viewer --> EmptyStringArray is a collection with 1 NULL element

Failing test

No response