test: add a test for JSON materialization#780
Conversation
During an attempt at optimizing the way that JSON queries are materialized, we discovered that Entity Framework does not dispose the stream that it receives. This means that we cannot easily optimize this by using for example a pooled buffer.
There was a problem hiding this comment.
Code Review
This pull request adds a unit test to verify that JSON queries materialize correctly and refactors CreateUtf8Stream in SpannerStructuralJsonTypeMapping to document the memory stream lifecycle and explain why pooled resources are avoided. The feedback suggests using an asynchronous await using var statement in the new test to reduce nesting and maintain consistency with the rest of the test suite.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds a new unit test JsonQuery_Materializes_Correctly to verify that JSON queries materialize correctly into structured objects. Additionally, it refactors the CreateUtf8Stream method in SpannerStructuralJsonTypeMapping to use a block body and adds an explanatory comment detailing why MemoryStream is allocated directly rather than using pooled resources to avoid memory leaks. There are no review comments, so I have no feedback to provide.
During an attempt at optimizing the way that JSON queries are materialized, we discovered that Entity Framework does not dispose the stream that it receives. This means that we cannot easily optimize this by using for example a pooled buffer.