-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNOW-1374896 unify structured types string representation #1882
Merged
sfc-gh-mkubik
merged 38 commits into
master
from
SNOW-1374896-unify-structured-types-string-representation
Sep 27, 2024
Merged
SNOW-1374896 unify structured types string representation #1882
sfc-gh-mkubik
merged 38 commits into
master
from
SNOW-1374896-unify-structured-types-string-representation
Sep 27, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add helper ArrowStringRepresentationBuilders that take care of converting recursive toString results into a valid json, taking logical type into accunt. Extract fetching logical type from field metadata to a separate static function, change boolean string representations to lowercase, add tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding custom to string for vectors, in case vector ever accepts types other than int and float.
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
Seems I haven't change all ocurrences of upper case booleans in tests, will fix in next commit |
sfc-gh-pbulawa
requested changes
Sep 3, 2024
src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java
Outdated
Show resolved
Hide resolved
src/test/java/net/snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringBaseIT.java
Outdated
Show resolved
Hide resolved
.../net/snowflake/client/core/arrow/tostringhelpers/ArrowObjectStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
Move prefix and suffix cofiguration to the constructor of base builder, remove unnecessary comments, extract shouldQuote check to a super method, make valueType a constructor parameter for Array toString builder, fix tests failing due to the lowercase booleans
Add helper ArrowStringRepresentationBuilders that take care of converting recursive toString results into a valid json, taking logical type into accunt. Extract fetching logical type from field metadata to a separate static function, change boolean string representations to lowercase, add tests.
Move prefix and suffix cofiguration to the constructor of base builder, remove unnecessary comments, extract shouldQuote check to a super method, make valueType a constructor parameter for Array toString builder, fix tests failing due to the lowercase booleans
sfc-gh-pbulawa
previously approved these changes
Sep 4, 2024
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
.../net/snowflake/client/core/arrow/tostringhelpers/ArrowObjectStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
...a/net/snowflake/client/core/arrow/tostringhelpers/ArrowArrayStringRepresentationBuilder.java
Outdated
Show resolved
Hide resolved
.../snowflake/client/jdbc/structuredtypes/StructuredTypesGetStringArrowJsonCompatibilityIT.java
Show resolved
Hide resolved
sfc-gh-pbulawa
approved these changes
Sep 11, 2024
sfc-gh-astachowski
approved these changes
Sep 13, 2024
…NOW-1374896-unify-structured-types-string-representation
Assert correct string conversion for AllTypesClass and NestedStruct in ResultSetStructuredTypesLatestIT
…aking jenkins build
sfc-gh-mkubik
deleted the
SNOW-1374896-unify-structured-types-string-representation
branch
September 27, 2024 15:24
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Overview
SNOW-1374896
Build string representations of Snowflake structured types recursively to reuse existing converters design for specific logical types (e.g. timestamps/binary)
Code replaces the existing structured types converters implementation that was running the native
getObject
method with a solution that utilises reading a field vectors within the structured type and running a proper converter on each nested type. Changes are made to Array, Map and Struct converters, helper methods are added to ArrowVectorConverter interface and newArrowStringRepresentationBuilder
classes that abstract away the logic of actually building a string object out of the arrow structured type.Follow ups:
null
while for JSON there'sundefined
which also is some kind of divergence but not necessarily something to fix as ARROW's null sounds more reasonableexample for
SELECT [12, 10, 5, NULL]::ARRAY(DOUBLE)
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX: