Skip to content

Commit

Permalink
Mapping to json node
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pmotacki committed Mar 28, 2024
1 parent 882c810 commit 10d8062
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,11 @@ public <T> Map<String, T> getMap(int columnIndex, Class<T> type) throws SQLExcep
Object object = getObject(columnIndex);
Map<String, Object> map;
if (object instanceof JsonSqlInput) {
map = new HashMap<>();
JsonNode jsonNode = ((JsonSqlInput) object).getInput();
map = OBJECT_MAPPER.convertValue(jsonNode, new TypeReference<Map<String, Object>>() {});
jsonNode
.fieldNames()
.forEachRemaining(node -> map.put(node.toString(), jsonNode.get(node.toString())));
} else {
map = (Map<String, Object>) object;
}
Expand All @@ -1565,7 +1568,7 @@ public <T> Map<String, T> getMap(int columnIndex, Class<T> type) throws SQLExcep
if (object instanceof JsonSqlInput) {
sqlInput =
new JsonSqlInput(
(((JsonSqlInput) object).getInput()).get(entry.getKey()),
(JsonNode) entry.getValue(),
session,
sfBaseResultSet.getConverters(),
sfBaseResultSet
Expand Down

0 comments on commit 10d8062

Please sign in to comment.