aloneguid / parquet-dotnet

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

Serializes the nullable TimeSpan property #517

Closed pawelciupkaOnwelo closed 4 weeks ago

pawelciupkaOnwelo commented 4 weeks ago

Issue description

Hello,

Will it be possible to serialize nullable TimeSpan class properties in the future?

Class:

public class Downtime
{
    public TimeSpan? Duration { get; set; }
}

Serialization code:

var data = new List<Downtime>() { new Downtime() { Duration = null } }

using MemoryStream memoryStream = new MemoryStream();
if (memoryStream != null)
{
    await ParquetSerializer.SerializeAsync(data, memoryStream, cancellationToken: cancellationToken);
    // ...
}

Error message:

Expression of type 'System.Nullable`1[System.TimeSpan]' cannot be used for parameter of type 'System.TimeSpan' of method 'Void Add(System.TimeSpan)' (Parameter 'arg0')

Thank you in advance.

aloneguid commented 4 weeks ago

This should work with no issues. Can you try latest preview nuget?

pawelciupkaOnwelo commented 4 weeks ago

I have cleaned and rebuild the entire solution to make sure I am using the latest version (4.23.5) and the problem still persists.

image

pawelciupkaOnwelo commented 4 weeks ago

This should work with no issues. Can you try latest preview nuget?

I made a mistake. I meant the TimeSpan type.

aloneguid commented 4 weeks ago

I meant latest "preview" version. But 4.24.0 was just released, please try to update now.

pawelciupkaOnwelo commented 4 weeks ago

I meant latest "preview" version. But 4.24.0 was just released, please try to update now.

Used 4.24.0 and it is working. Thanks for support!