fix: /inserts-stream endpoint now accepts complex types #5469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Three changes in this PR:
(1) Prior to this PR, inserting a row with a complex column type (array, map, or struct) via /inserts-stream would fail since the SqlValueCoercer can't handle JsonArray or JsonObject. This PR fixes the bug.
(2) This PR adds server-side and client-side test coverage for complex types including decimal, array, and map. A follow-up PR will add coverage for struct as well.
(3) Besides (1), the only other non-test change in this PR is in response to #5448 (comment): rather than serializing BigDecimal as double on the client, we instead serialize BigDecimal as string in order to avoid loss of precision. The drawback is we now have an inconsistency where the decimal type is treated differently in terms of allowable casts, compared to the other numeric types. For example:
Testing done
Tests pass.
Reviewer checklist