ChoETL icon indicating copy to clipboard operation
ChoETL copied to clipboard

NullReferenceException when trying to write class with nullable fields out to parquet.

Open totalgit74 opened this issue 3 years ago • 3 comments

// items is IEnumerable<MyClass>
using (var writer = new ChoParquetWriter<MyClass>(new ChoParquetRecordConfiguration
                   {
                       NullValueHandling = ChoNullValueHandling.Null
                   }))
            {
                writer.Write(items);
            }

yields exception

System.NullReferenceException: 'Object reference not set to an instance of an object.'

Examples of field types that may be causing the issue are

bool?, decimal?, int?, DateTime?, TimeSpan?

I have previously created the writer with a null configuration class and still received the same result. Is there a way of getting this to happen or is there a more fundamental issue somewhere?

totalgit74 avatar Aug 28 '22 23:08 totalgit74

Not able to reproduce it. Wrote a sample fiddle

https://dotnetfiddle.net/TM2dW4

Pls review and share with more info.

Cinchoo avatar Sep 06 '22 12:09 Cinchoo

You’ve used nullable long and double - simple number types. I suspect the issue may be related to handling of nullable datetime and timespan types which may be slightly less common

totalgit74 avatar Sep 07 '22 07:09 totalgit74

Added support for nullable datetime, timespan fields. Released v1.0.1.23-beta6.

Give it a try and let me know.

Cinchoo avatar Sep 07 '22 20:09 Cinchoo