From 51ceb4fbf34b08d4c41e2e89621714a9bc0b1ffa Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Mon, 9 Dec 2024 21:37:01 +0100 Subject: [PATCH 1/8] SNOW-1689931 Adding flag to skip token file permission verification --- .../client/core/SFArrowResultSet.java | 33 ++++++++++++++++--- .../client/core/SFBaseResultSet.java | 3 ++ .../client/core/SFJsonResultSet.java | 5 +++ .../client/core/arrow/MapConverter.java | 10 ++---- .../client/core/arrow/StructConverter.java | 4 +-- .../client/jdbc/SnowflakeBaseResultSet.java | 7 ++-- 6 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index 69195e8a4..9691d7880 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -26,6 +26,7 @@ import java.util.stream.Stream; import net.snowflake.client.core.arrow.ArrayConverter; import net.snowflake.client.core.arrow.ArrowVectorConverter; +import net.snowflake.client.core.arrow.StructConverter; import net.snowflake.client.core.arrow.StructObjectWrapper; import net.snowflake.client.core.arrow.VarCharConverter; import net.snowflake.client.core.arrow.VectorTypeConverter; @@ -564,6 +565,16 @@ public Timestamp getTimestamp(int columnIndex, TimeZone tz) throws SFException { @Override public Object getObject(int columnIndex) throws SFException { + return getObjectRepresentation(columnIndex, true); + } + + @SnowflakeJdbcInternalApi + @Override + public Object getObject(int columnIndex, Class type) throws SFException { + return getObjectRepresentation(columnIndex, false); + } + + private Object getObjectRepresentation(int columnIndex, boolean withString) throws SFException { int type = resultSetMetaData.getColumnType(columnIndex); if (type == SnowflakeUtil.EXTRA_TYPES_VECTOR) { return getString(columnIndex); @@ -575,13 +586,27 @@ public Object getObject(int columnIndex) throws SFException { converter.setUseSessionTimezone(useSessionTimezone); converter.setSessionTimeZone(sessionTimeZone); Object obj = converter.toObject(index); + if (obj == null) { + return null; + } + String jsonString = withString ? converter.toString(index) : null; boolean isStructuredType = resultSetMetaData.isStructuredTypeColumn(columnIndex); if (isVarcharConvertedStruct(type, isStructuredType, converter)) { - if (obj != null) { - return new StructObjectWrapper((String) obj, createJsonSqlInput(columnIndex, obj)); - } + return new StructObjectWrapper(jsonString, createJsonSqlInput(columnIndex, obj)); + } else if (converter instanceof StructConverter) { + return new StructObjectWrapper(jsonString, createArrowSqlInput(columnIndex, (Map) obj)); + } else { + return new StructObjectWrapper(jsonString, obj); + } + } + + private SQLInput createArrowSqlInput(int columnIndex, Map input) + throws SFException { + if (input == null) { + return null; } - return obj; + return new ArrowSqlInput( + input, session, converters, resultSetMetaData.getColumnFields(columnIndex)); } private boolean isVarcharConvertedStruct( diff --git a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java index c0b6256ad..5a45c82b1 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java @@ -113,6 +113,9 @@ public abstract class SFBaseResultSet { public abstract Object getObject(int columnIndex) throws SFException; + @SnowflakeJdbcInternalApi + public abstract Object getObject(int columnIndex, Class type) throws SFException; + public Array getArray(int columnIndex) throws SFException { throw new UnsupportedOperationException(); } diff --git a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java index 04e8d3fba..1070d04fd 100644 --- a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java @@ -103,6 +103,11 @@ public Object getObject(int columnIndex) throws SFException { } } + @SnowflakeJdbcInternalApi + @Override + public Object getObject(int columnIndex, Class type) throws SFException { + return getObject(columnIndex); + } /** * Sometimes large BIGINTS overflow the java Long type. In these cases, return a BigDecimal type * instead. diff --git a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java index 0c6ca072e..6b1d9a0f5 100644 --- a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java @@ -33,15 +33,11 @@ public Object toObject(int index) throws SFException { if (isNull(index)) { return null; } - List> entriesList = - (List>) vector.getObject(index); - Map map = - entriesList.stream() + (List>) vector.getObject(index); + return entriesList.stream() .collect( - Collectors.toMap( - entry -> entry.get("key").toString(), entry -> entry.get("value"))); - return new StructObjectWrapper(toString(index), map); + Collectors.toMap(entry -> entry.get("key").toString(), entry -> entry.get("value"))); } @Override diff --git a/src/main/java/net/snowflake/client/core/arrow/StructConverter.java b/src/main/java/net/snowflake/client/core/arrow/StructConverter.java index ab7d20382..c2ef36ef7 100644 --- a/src/main/java/net/snowflake/client/core/arrow/StructConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/StructConverter.java @@ -21,9 +21,7 @@ public StructConverter(StructVector vector, int columnIndex, DataConversionConte @Override public Object toObject(int index) throws SFException { - return isNull(index) - ? null - : new StructObjectWrapper(toString(index), structVector.getObject(index)); + return isNull(index) ? null : structVector.getObject(index); } @Override diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java index 633083391..bd01cff15 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java @@ -1399,7 +1399,10 @@ public T getObject(int columnIndex, Class type) throws SQLException { () -> { StructObjectWrapper structObjectWrapper = (StructObjectWrapper) sfBaseResultSet.getObject(columnIndex); - return (SQLInput) createJsonSqlInput(columnIndex, structObjectWrapper); + if (structObjectWrapper == null) { + return null; + } + return (SQLInput) structObjectWrapper.getObject(); }); if (sqlInput == null) { return null; @@ -1639,7 +1642,7 @@ public Map getMap(int columnIndex, Class type) throws SQLExcep StructObjectWrapper structObjectWrapper = (StructObjectWrapper) SnowflakeUtil.mapSFExceptionToSQLException( - () -> sfBaseResultSet.getObject(columnIndex)); + () -> sfBaseResultSet.getObject(columnIndex, type)); if (structObjectWrapper == null) { return null; } From bab618816c08a5205312f8013acd99eaa43e76a9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Mon, 9 Dec 2024 22:00:59 +0100 Subject: [PATCH 2/8] fix for structured types strings --- .../client/core/SFArrowResultSet.java | 9 +++--- .../client/core/arrow/MapConverter.java | 7 ++--- .../client/jdbc/SnowflakeResultSetV1.java | 29 ++++++++++++------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index 9691d7880..96ee6053f 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -592,21 +592,22 @@ private Object getObjectRepresentation(int columnIndex, boolean withString) thro String jsonString = withString ? converter.toString(index) : null; boolean isStructuredType = resultSetMetaData.isStructuredTypeColumn(columnIndex); if (isVarcharConvertedStruct(type, isStructuredType, converter)) { - return new StructObjectWrapper(jsonString, createJsonSqlInput(columnIndex, obj)); + return new StructObjectWrapper(jsonString, createJsonSqlInput(columnIndex, obj)); } else if (converter instanceof StructConverter) { - return new StructObjectWrapper(jsonString, createArrowSqlInput(columnIndex, (Map) obj)); + return new StructObjectWrapper( + jsonString, createArrowSqlInput(columnIndex, (Map) obj)); } else { return new StructObjectWrapper(jsonString, obj); } } private SQLInput createArrowSqlInput(int columnIndex, Map input) - throws SFException { + throws SFException { if (input == null) { return null; } return new ArrowSqlInput( - input, session, converters, resultSetMetaData.getColumnFields(columnIndex)); + input, session, converters, resultSetMetaData.getColumnFields(columnIndex)); } private boolean isVarcharConvertedStruct( diff --git a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java index 6b1d9a0f5..f2e05744a 100644 --- a/src/main/java/net/snowflake/client/core/arrow/MapConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/MapConverter.java @@ -2,7 +2,6 @@ import java.nio.charset.StandardCharsets; 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; @@ -34,10 +33,10 @@ public Object toObject(int index) throws SFException { return null; } List> entriesList = - (List>) vector.getObject(index); + (List>) vector.getObject(index); return entriesList.stream() - .collect( - Collectors.toMap(entry -> entry.get("key").toString(), entry -> entry.get("value"))); + .collect( + Collectors.toMap(entry -> entry.get("key").toString(), entry -> entry.get("value"))); } @Override diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index e9db5ec71..843e3c135 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -274,18 +274,27 @@ public Object getObject(int columnIndex) throws SQLException { SnowflakeUtil.mapSFExceptionToSQLException(() -> sfBaseResultSet.getObject(columnIndex)); if (object == null) { return null; - } else if (object instanceof JsonSqlInput) { - return ((JsonSqlInput) object).getText(); - } else if (object instanceof StructObjectWrapper) { - return ((StructObjectWrapper) object).getJsonString(); - } else if (object instanceof SfSqlArray) { + } + if (object instanceof SfSqlArray) { return ((SfSqlArray) object).getText(); - } else if (object instanceof ArrowSqlInput) { - throw new SQLException( - "Arrow native struct couldn't be converted to String. To map to SqlData the method getObject(int columnIndex, Class type) should be used"); - } else { - return object; } + if (object instanceof StructObjectWrapper) { + StructObjectWrapper structObjectWrapper = (StructObjectWrapper) object; + if (structObjectWrapper.getObject() instanceof JsonSqlInput) { + return ((JsonSqlInput) structObjectWrapper.getObject()).getText(); + } + if (structObjectWrapper.getObject() instanceof ArrowSqlInput) { + throw new SQLException( + "Arrow native struct couldn't be converted to String. To map to SqlData the method getObject(int columnIndex, Class type) should be used"); + } + if (structObjectWrapper.getObject() != null) { + return structObjectWrapper.getObject(); + } + if (structObjectWrapper.getJsonString() != null) { + return structObjectWrapper.getJsonString(); + } + } + return object; } public Array getArray(int columnIndex) throws SQLException { From 938807942322194fbb928d4cb03f488ec2a4bc96 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 09:32:17 +0100 Subject: [PATCH 3/8] fix for structured types strings --- .../java/net/snowflake/client/core/SFArrowResultSet.java | 7 ++----- .../net/snowflake/client/core/arrow/ArrayConverter.java | 2 +- .../snowflake/client/core/arrow/VectorTypeConverter.java | 2 +- .../net/snowflake/client/jdbc/SnowflakeResultSetV1.java | 8 ++------ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index 96ee6053f..aa331ed54 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -646,11 +646,8 @@ public Array getArray(int columnIndex) throws SFException { if (converter instanceof VarCharConverter) { return getJsonArray((String) obj, columnIndex); } else if (converter instanceof ArrayConverter || converter instanceof VectorTypeConverter) { - StructObjectWrapper structObjectWrapper = (StructObjectWrapper) obj; - return getArrowArray( - structObjectWrapper.getJsonString(), - (List) structObjectWrapper.getObject(), - columnIndex); + String jsonString = converter.toString(index); + return getArrowArray(jsonString, (List) obj, columnIndex); } else { throw new SFException(queryId, ErrorCode.INVALID_STRUCT_DATA); } diff --git a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java index 96b683151..6c6afcd62 100644 --- a/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/ArrayConverter.java @@ -25,7 +25,7 @@ public ArrayConverter(ListVector valueVector, int vectorIndex, DataConversionCon @Override public Object toObject(int index) throws SFException { - return isNull(index) ? null : new StructObjectWrapper(toString(index), vector.getObject(index)); + return isNull(index) ? null : vector.getObject(index); } @Override diff --git a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java index cb9dcad73..cb6edd529 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java @@ -28,7 +28,7 @@ public Object toObject(int index) throws SFException { return null; } Object object = vector.getObject(index); - return new StructObjectWrapper(object.toString(), object); + return object; } @Override diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index 843e3c135..273cd181e 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -280,12 +280,8 @@ public Object getObject(int columnIndex) throws SQLException { } if (object instanceof StructObjectWrapper) { StructObjectWrapper structObjectWrapper = (StructObjectWrapper) object; - if (structObjectWrapper.getObject() instanceof JsonSqlInput) { - return ((JsonSqlInput) structObjectWrapper.getObject()).getText(); - } - if (structObjectWrapper.getObject() instanceof ArrowSqlInput) { - throw new SQLException( - "Arrow native struct couldn't be converted to String. To map to SqlData the method getObject(int columnIndex, Class type) should be used"); + if (structObjectWrapper.getJsonString() != null) { + return structObjectWrapper.getJsonString(); } if (structObjectWrapper.getObject() != null) { return structObjectWrapper.getObject(); From ef9794767a2939b233da91c44449dbf658b15eec Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 09:33:43 +0100 Subject: [PATCH 4/8] fix for structured types strings --- .../java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index 273cd181e..2ecf07bce 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -28,8 +28,6 @@ import java.util.List; import java.util.Map; import java.util.TimeZone; -import net.snowflake.client.core.ArrowSqlInput; -import net.snowflake.client.core.JsonSqlInput; import net.snowflake.client.core.QueryStatus; import net.snowflake.client.core.SFBaseResultSet; import net.snowflake.client.core.SFException; From 50c273f8468f5bb94d2bf86d95da8ec813c4c07c Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 09:51:46 +0100 Subject: [PATCH 5/8] fix for structured types strings --- .../net/snowflake/client/jdbc/SnowflakeResultSetV1.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java index 2ecf07bce..2a3e429ad 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeResultSetV1.java @@ -278,15 +278,13 @@ public Object getObject(int columnIndex) throws SQLException { } if (object instanceof StructObjectWrapper) { StructObjectWrapper structObjectWrapper = (StructObjectWrapper) object; - if (structObjectWrapper.getJsonString() != null) { + if (resultSetMetaData.isStructuredTypeColumn(columnIndex) + && structObjectWrapper.getJsonString() != null) { return structObjectWrapper.getJsonString(); } if (structObjectWrapper.getObject() != null) { return structObjectWrapper.getObject(); } - if (structObjectWrapper.getJsonString() != null) { - return structObjectWrapper.getJsonString(); - } } return object; } From cc0e6c759f7037275f190737271d7991143930e5 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 12:42:15 +0100 Subject: [PATCH 6/8] fix for structured types strings --- src/main/java/net/snowflake/client/core/SFArrowResultSet.java | 2 +- src/main/java/net/snowflake/client/core/SFBaseResultSet.java | 2 +- src/main/java/net/snowflake/client/core/SFJsonResultSet.java | 2 +- .../net/snowflake/client/jdbc/SnowflakeBaseResultSet.java | 4 ++-- .../structuredtypes/ResultSetStructuredTypesLatestIT.java | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java index aa331ed54..ff0142377 100644 --- a/src/main/java/net/snowflake/client/core/SFArrowResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFArrowResultSet.java @@ -570,7 +570,7 @@ public Object getObject(int columnIndex) throws SFException { @SnowflakeJdbcInternalApi @Override - public Object getObject(int columnIndex, Class type) throws SFException { + public Object getObjectWithoutString(int columnIndex) throws SFException { return getObjectRepresentation(columnIndex, false); } diff --git a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java index 5a45c82b1..cd1539a5d 100644 --- a/src/main/java/net/snowflake/client/core/SFBaseResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFBaseResultSet.java @@ -114,7 +114,7 @@ public abstract class SFBaseResultSet { public abstract Object getObject(int columnIndex) throws SFException; @SnowflakeJdbcInternalApi - public abstract Object getObject(int columnIndex, Class type) throws SFException; + public abstract Object getObjectWithoutString(int columnIndex) throws SFException; public Array getArray(int columnIndex) throws SFException { throw new UnsupportedOperationException(); diff --git a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java index 1070d04fd..d6a65aaaa 100644 --- a/src/main/java/net/snowflake/client/core/SFJsonResultSet.java +++ b/src/main/java/net/snowflake/client/core/SFJsonResultSet.java @@ -105,7 +105,7 @@ public Object getObject(int columnIndex) throws SFException { @SnowflakeJdbcInternalApi @Override - public Object getObject(int columnIndex, Class type) throws SFException { + public Object getObjectWithoutString(int columnIndex) throws SFException { return getObject(columnIndex); } /** diff --git a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java index bd01cff15..c92be254e 100644 --- a/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java +++ b/src/main/java/net/snowflake/client/jdbc/SnowflakeBaseResultSet.java @@ -1398,7 +1398,7 @@ public T getObject(int columnIndex, Class type) throws SQLException { SnowflakeUtil.mapSFExceptionToSQLException( () -> { StructObjectWrapper structObjectWrapper = - (StructObjectWrapper) sfBaseResultSet.getObject(columnIndex); + (StructObjectWrapper) sfBaseResultSet.getObjectWithoutString(columnIndex); if (structObjectWrapper == null) { return null; } @@ -1642,7 +1642,7 @@ public Map getMap(int columnIndex, Class type) throws SQLExcep StructObjectWrapper structObjectWrapper = (StructObjectWrapper) SnowflakeUtil.mapSFExceptionToSQLException( - () -> sfBaseResultSet.getObject(columnIndex, type)); + () -> sfBaseResultSet.getObjectWithoutString(columnIndex)); if (structObjectWrapper == null) { return null; } diff --git a/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java b/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java index f9b3368d8..532d78ace 100644 --- a/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java @@ -265,7 +265,6 @@ public void testReturnAsArrayOfNullableFieldsInSqlData(ResultSetFormatType forma (resultSet) -> { NullableFieldsSqlData result = resultSet - .unwrap(SnowflakeBaseResultSet.class) .getObject(1, NullableFieldsSqlData.class); assertNull(result.getString()); assertNull(result.getNullableIntValue()); From a16a2d08cd05d40b0ea3c0e24985608047baab80 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 12:42:37 +0100 Subject: [PATCH 7/8] fix for structured types strings --- .../structuredtypes/ResultSetStructuredTypesLatestIT.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java b/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java index 532d78ace..01e5fde96 100644 --- a/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java +++ b/src/test/java/net/snowflake/client/jdbc/structuredtypes/ResultSetStructuredTypesLatestIT.java @@ -263,9 +263,7 @@ public void testReturnAsArrayOfNullableFieldsInSqlData(ResultSetFormatType forma + "'date', null, 'bd', null, 'bytes', null, 'longValue', null)" + "::OBJECT(string VARCHAR, nullableIntValue INTEGER, nullableLongValue INTEGER, date DATE, bd DOUBLE, bytes BINARY, longValue INTEGER)", (resultSet) -> { - NullableFieldsSqlData result = - resultSet - .getObject(1, NullableFieldsSqlData.class); + NullableFieldsSqlData result = resultSet.getObject(1, NullableFieldsSqlData.class); assertNull(result.getString()); assertNull(result.getNullableIntValue()); assertNull(result.getNullableLongValue()); From 46bfd71a549485508fcf71044afd813f06a9dc37 Mon Sep 17 00:00:00 2001 From: Przemyslaw Motacki Date: Tue, 10 Dec 2024 13:47:59 +0100 Subject: [PATCH 8/8] fix for structured types strings --- .../net/snowflake/client/core/arrow/VectorTypeConverter.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java index cb6edd529..2050a3d1f 100644 --- a/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java +++ b/src/main/java/net/snowflake/client/core/arrow/VectorTypeConverter.java @@ -27,8 +27,7 @@ public Object toObject(int index) throws SFException { if (isNull(index)) { return null; } - Object object = vector.getObject(index); - return object; + return vector.getObject(index); } @Override