|
46 | 46 | import net.snowflake.client.core.SFBaseSession;
|
47 | 47 | import net.snowflake.client.core.SFException;
|
48 | 48 | import net.snowflake.client.core.structs.SQLDataCreationHelper;
|
| 49 | +import net.snowflake.client.core.structs.StructureTypeHelper; |
49 | 50 | import net.snowflake.client.log.SFLogger;
|
50 | 51 | import net.snowflake.client.log.SFLoggerFactory;
|
51 | 52 | import net.snowflake.common.core.SqlState;
|
@@ -1352,21 +1353,24 @@ public void updateNClob(String columnLabel, Reader reader) throws SQLException {
|
1352 | 1353 | @Override
|
1353 | 1354 | public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
|
1354 | 1355 | logger.debug("public <T> T getObject(int columnIndex,Class<T> type)", false);
|
1355 |
| - if (SQLData.class.isAssignableFrom(type)) { |
1356 |
| - SQLData instance = (SQLData) SQLDataCreationHelper.create(type); |
1357 |
| - SQLInput sqlInput = (SQLInput) getObject(columnIndex); |
1358 |
| - instance.readSQL(sqlInput, null); |
1359 |
| - return (T) instance; |
1360 |
| - } else if (Map.class.isAssignableFrom(type)) { |
1361 |
| - Object object = getObject(columnIndex); |
1362 |
| - if (object instanceof JsonSqlInput) { |
1363 |
| - JsonNode jsonNode = ((JsonSqlInput) object).getInput(); |
1364 |
| - return (T) |
1365 |
| - OBJECT_MAPPER.convertValue(jsonNode, new TypeReference<Map<String, Object>>() {}); |
1366 |
| - } else { |
1367 |
| - return (T) ((ArrowSqlInput) object).getInput(); |
| 1356 | + if (StructureTypeHelper.isStructureTypeEnabled()) { |
| 1357 | + if (SQLData.class.isAssignableFrom(type)) { |
| 1358 | + SQLData instance = (SQLData) SQLDataCreationHelper.create(type); |
| 1359 | + SQLInput sqlInput = (SQLInput) getObject(columnIndex); |
| 1360 | + instance.readSQL(sqlInput, null); |
| 1361 | + return (T) instance; |
| 1362 | + } else if (Map.class.isAssignableFrom(type)) { |
| 1363 | + Object object = getObject(columnIndex); |
| 1364 | + if (object instanceof JsonSqlInput) { |
| 1365 | + JsonNode jsonNode = ((JsonSqlInput) object).getInput(); |
| 1366 | + return (T) |
| 1367 | + OBJECT_MAPPER.convertValue(jsonNode, new TypeReference<Map<String, Object>>() {}); |
| 1368 | + } else { |
| 1369 | + return (T) ((ArrowSqlInput) object).getInput(); |
| 1370 | + } |
1368 | 1371 | }
|
1369 |
| - } else if (String.class.isAssignableFrom(type)) { |
| 1372 | + } |
| 1373 | + if (String.class.isAssignableFrom(type)) { |
1370 | 1374 | return (T) getString(columnIndex);
|
1371 | 1375 | } else if (Boolean.class.isAssignableFrom(type)) {
|
1372 | 1376 | return (T) (Boolean) getBoolean(columnIndex);
|
@@ -1405,6 +1409,10 @@ public <T> List<T> getList(int columnIndex, Class<T> type) throws SQLException {
|
1405 | 1409 | }
|
1406 | 1410 |
|
1407 | 1411 | public <T> T[] getArray(int columnIndex, Class<T> type) throws SQLException {
|
| 1412 | + logger.debug("public <T> T[] getArray(int columnIndex, Class<T> type)", false); |
| 1413 | + if (!StructureTypeHelper.isStructureTypeEnabled()) { |
| 1414 | + throw new SnowflakeLoggedFeatureNotSupportedException(session); |
| 1415 | + } |
1408 | 1416 | FieldMetadata fieldMetadata =
|
1409 | 1417 | sfBaseResultSet.getMetaData().getColumnMetadata().get(columnIndex - 1).getFields().get(0);
|
1410 | 1418 | int columnSubType = fieldMetadata.getType();
|
@@ -1545,6 +1553,10 @@ public <T> T[] getArray(int columnIndex, Class<T> type) throws SQLException {
|
1545 | 1553 | }
|
1546 | 1554 |
|
1547 | 1555 | public <T> Map<String, T> getMap(int columnIndex, Class<T> type) throws SQLException {
|
| 1556 | + logger.debug("public <T> Map<String, T> getMap(int columnIndex, Class<T> type)", false); |
| 1557 | + if (!StructureTypeHelper.isStructureTypeEnabled()) { |
| 1558 | + throw new SnowflakeLoggedFeatureNotSupportedException(session); |
| 1559 | + } |
1548 | 1560 | FieldMetadata valueFieldMetadata =
|
1549 | 1561 | sfBaseResultSet.getMetaData().getColumnMetadata().get(columnIndex - 1).getFields().get(1);
|
1550 | 1562 | int columnSubType = valueFieldMetadata.getType();
|
|
0 commit comments