-
Notifications
You must be signed in to change notification settings - Fork 170
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-1812949 add get object and get bytes support for native arrow structured types #1968
base: master
Are you sure you want to change the base?
SNOW-1812949 add get object and get bytes support for native arrow structured types #1968
Conversation
…ormat ARROW is set
…, add variant test case
return createJsonSqlInput(columnIndex, obj); | ||
} else if (converter instanceof StructConverter) { | ||
return createArrowSqlInput(columnIndex, (Map<String, Object>) obj); | ||
if (type == Types.STRUCT && isStructuredType && converter instanceof VarCharConverter) { |
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.
Could we extract these conditions?
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.
You mean something like isVarcharConvertedStructuredType()
function? I also consider some rearrangement of conditions but not sure how to make it pretty:
if (type != Types.STRUCT) {
return obj;
}
if (!resultSetMetaData.isStructuredTypeColumn(columnIndex)) {
return obj;
}
if (!(converter instanceof VarCharConverter)) {
return obj;
}
if (obj != null) {
return new StructObjectWrapper((String) obj, createJsonSqlInput(columnIndex, obj));
}
return null;
return text; | ||
} | ||
|
||
private static String buildJsonStringFromElements(Object elements) throws SQLException { | ||
try { | ||
return SnowflakeUtil.mapJson(elements); |
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.
Here, we create JSON using ObjectMapper. Shouldn't it be created by our types mappers?
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.
I think this method is used for both JSON and ARROW data. For arrow structured types the text field will always be set so it won't be executed. Now I think that it may be worth to check for potential divergence in primitive types though
...net/snowflake/client/jdbc/structuredtypes/StructuredTypesArrowJsonCompatibilityLatestIT.java
Outdated
Show resolved
Hide resolved
…y, simplify getObject conditions
…queried resultSet
Add getObject and getBytes implementations for native arrow structured types
SNOW-1812949
The getString unification was already introduced to JDBC driver. This PR introduces changes for getObject and getBytes functions:
Pre-review self checklist
master
branchmvn -P check-style validate
)mvn verify
and inspecttarget/japicmp/japicmp.html
)SNOW-XXXX: