question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: Nested nulls can be interpreted at the wrong level

See original GitHub issue

Library 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:closed
  • Created 6 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Mrinal-Thomas-Epiccommented, Apr 26, 2023

Sorry for the late reply. Thanks for the quick fix!

0reactions
aloneguidcommented, Apr 20, 2023

Feel free to ask more questions! Don’t forget to star the project and make the code world a better place!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found