Skip to content

Fix to #33547 - Breaking Change in 8.0.4: System.InvalidOperationException: The data is NULL at ordinal 0. This method can't be called on NULL values. Check using IsDBNull before calling.#33559

Merged
maumar merged 1 commit into
mainfrom
fix33547
May 9, 2024

Conversation

@maumar

@maumar maumar commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

Problem was that we changed the way that we store complex type information in the StructuralTypeProjectionExpression, specifically after performing pushdown. We used to extract all the properties from complex types into a flat list, along with regular properties, but that was wrong - we need to uphold the nested structure. If that STPE with flattened structure would be made nullable, we go through all the properties and mark the column expressions as nullable (which included properties of a complex type). However, in the new regime, we were not making those changes to columns representing complex type in the nested structure. As a result, if those columns were later projected (after pushdown), they would seem to be non-nullable, and could cause errors.

Fix is, during MakeNullable() operation for a complex type StructuralTypeProjectionExpression, to peek inside it's ValueBufferExpression and mark all the columns found there as nullable.

Fixes #33547

@maumar maumar requested a review from roji April 18, 2024 08:31
…ption: The data is NULL at ordinal 0. This method can't be called on NULL values. Check using IsDBNull before calling.

Problem was that we changed the way that we store complex type information in the StructuralTypeProjectionExpression, specifically after performing pushdown. We used to extract all the properties from complex types into a flat list, along with regular properties, but that was wrong - we need to uphold the nested structure.
If that STPE with flattened structure would be made nullable, we go through all the properties and mark the  column expressions as nullable (which included properties of a complex type). However, in the new regime, we were not making those changes to columns representing complex type in the nested structure.
As a result, if those columns were later projected (after pushdown), they would seem to be non-nullable, and could cause errors.

Fix is, during MakeNullable() operation for a complex type StructuralTypeProjectionExpression, to peek inside it's ValueBufferExpression and mark all the columns found there as nullable.

Fixes #33547
@maumar maumar requested a review from a team May 8, 2024 06:40
@maumar

maumar commented May 8, 2024

Copy link
Copy Markdown
Contributor Author

ping, this issue is candidate for a patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants