-
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: return toString result for getObject called on structured types #1945
base: master
Are you sure you want to change the base?
SNOW-1374896: return toString result for getObject called on structured types #1945
Conversation
…ormat ARROW is set
.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 comment
The reason will be displayed to describe this comment to others. Learn more.
can we return null before processing entries?
return entriesList.stream() | ||
.collect( | ||
Collectors.toMap(entry -> entry.get("key").toString(), entry -> entry.get("value"))); | ||
Map map = |
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
Map<String, T> resultMap = new HashMap<>(); | ||
for (Map.Entry<String, Object> entry : map.entrySet()) { | ||
if (SQLData.class.isAssignableFrom(type)) { | ||
SQLData instance = (SQLData) SQLDataCreationHelper.create(type); | ||
SQLInput sqlInput = | ||
sfBaseResultSet.createSqlInputForColumn( | ||
entry.getValue(), | ||
object.getClass(), | ||
object.getObject().getClass(), |
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.
object.getObject() looks strange - can we rename variable?
} else if (object instanceof StructObject) { | ||
return ((StructObject) object).getStringJson(); | ||
} else if (object instanceof SfSqlArray) { | ||
return ((SfSqlArray) object).getJsonString(); |
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.
can we decide to have method getStringJson
or getJsonString
?
@@ -62,6 +62,15 @@ public void testRunAsGetString() throws SQLException { | |||
(resultSet) -> assertGetStringIsCompatible(resultSet, expectedStructureTypeRepresentation)); | |||
} | |||
|
|||
@Test | |||
@ConditionalIgnoreRule.ConditionalIgnore(condition = RunningOnGithubAction.class) |
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.
we still cannot run tests on Github?
SNOW-1374896
Turns out that backward compatibility with JSON structured types may also require support for getObject and getBytes methods.
This PR adds JSON/ARROW compatibility for getObject
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX: