-
Notifications
You must be signed in to change notification settings - Fork 167
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: return toString result for getObject called on structured types #1945
Open
sfc-gh-mkubik
wants to merge
5
commits into
master
Choose a base branch
from
SNOW-1374896-add-get-object-and-bytes-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+165
−57
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
93e98ea
return toStringResult for getObject and getBytes called on structured…
sfc-gh-mkubik 3ae60f5
fix formatting
sfc-gh-mkubik a55e26a
remove getBytes implementation from structured types converters
sfc-gh-mkubik 2e86075
remove getBytes, add null check to getObject
sfc-gh-mkubik c807e36
SNOW-1374896 Returning json string from method getObject when resultF…
sfc-gh-pmotacki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package net.snowflake.client.core.arrow; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import net.snowflake.client.core.DataConversionContext; | ||
import net.snowflake.client.core.SFException; | ||
|
@@ -24,9 +25,12 @@ public MapConverter(MapVector valueVector, int columnIndex, DataConversionContex | |
public Object toObject(int index) throws SFException { | ||
List<JsonStringHashMap<String, Object>> entriesList = | ||
(List<JsonStringHashMap<String, Object>>) vector.getObject(index); | ||
return entriesList.stream() | ||
.collect( | ||
Collectors.toMap(entry -> entry.get("key").toString(), entry -> entry.get("value"))); | ||
Map map = | ||
entriesList.stream() | ||
.collect( | ||
Collectors.toMap( | ||
entry -> entry.get("key").toString(), entry -> entry.get("value"))); | ||
return isNull(index) ? null : new StructObject(toString(index), map); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we return null before processing entries? |
||
} | ||
|
||
@Override | ||
|
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
22 changes: 22 additions & 0 deletions
22
src/main/java/net/snowflake/client/core/arrow/StructObject.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.snowflake.client.core.arrow; | ||
|
||
import net.snowflake.client.core.SnowflakeJdbcInternalApi; | ||
|
||
@SnowflakeJdbcInternalApi | ||
public class StructObject { | ||
private final String stringJson; | ||
private final Object object; | ||
|
||
public StructObject(String stringJson, Object object) { | ||
this.stringJson = stringJson; | ||
this.object = object; | ||
} | ||
|
||
public String getStringJson() { | ||
return stringJson; | ||
} | ||
|
||
public Object getObject() { | ||
return object; | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
let's add generics