[BUG]: Nested nulls can be interpreted at the wrong level
See original GitHub issueLibrary Version
4.6.1
OS
Linux
OS Architecture
64 bit
How to reproduce?
I’m encountering problems with serialization of nested null values. Results of serialization->deserialiation can interpret the null at the wrong level.
I encountered issues working with the Table API with nested arrays, but when I tried to put together a minimal breaking example, I found this relatively simple case that leads to failure with the Class API, without arrays.
Failing test
Try this test in ParquetSerializerTest.cs
:
[Fact]
public async Task Struct_Serde_With_NestedNulls() {
var data = new List<AddressBookEntry> {
new AddressBookEntry {
FirstName = "Joe",
LastName = "Bloggs",
Address = new Address() {
City = null,
Country = null
}
}
};
using var ms = new MemoryStream();
await ParquetSerializer.SerializeAsync(data, ms);
ms.Position = 0;
IList<AddressBookEntry> data2 = await ParquetSerializer.DeserializeAsync<AddressBookEntry>(ms);
Assert.Equivalent(data2, data);
}
This tests should succeed, but it fails with
[xUnit.net 00:00:01.16] Parquet.Test.Serialisation.ParquetSerializerTest.Struct_Serde_With_NestedNulls [FAIL]
Failed Parquet.Test.Serialisation.ParquetSerializerTest.Struct_Serde_With_NestedNulls [269 ms]
Error Message:
Assert.Equivalent() Failure: Collection value not found
Expected: AddressBookEntry { Address = null, FirstName = "Joe", LastName = "Bloggs" }
In: [AddressBookEntry { Address = Address { ... }, FirstName = "Joe", LastName = "Bloggs" }]
Stack Trace:
at Parquet.Test.Serialisation.ParquetSerializerTest.Struct_Serde_With_NestedNulls() in /tmp/parquet-dotnet/src/Parquet.Test/Serialisation/ParquetSerializerTest.cs:line 118
--- End of stack trace from previous location ---
Failed! - Failed: 1, Passed: 0, Skipped: 0, Total: 1, Duration: < 1 ms - Parquet.Test.dll (net7.0)
Issue Analytics
- State:
- Created 6 months ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Java: avoid checking for null in nested classes (Deep ...
Any "intermediate" class can be null. So, is there a simple way to get to PostalCode without having to check for null in...
Read more >Bug: Nested value of null marks form dirty on init #585
It seems to be only a problem with nested values of type null . Top level values of null do not seem to...
Read more >Access nested property in java without null pointer exception
So all I am doing is trying to read that message. But it goes wrong when object of ClassB may not be available...
Read more >Re: Impala bug with nested arrays of structures wh...
This issue it causes is that if the first column read is the collection with NULL in the row, then the 0 def...
Read more >Handling Nulls in nested objects (Java) - Lalit Vatsal - Medium
where each object and/or value can be nullable. Say our objective is to create a greeting for the name nested three level deep...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the late reply. Thanks for the quick fix!
Feel free to ask more questions! Don’t forget to star the project and make the code world a better place!