From fa6b3cf760d488e07c1c515d1db4868daf8cce50 Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Tue, 5 May 2026 15:00:27 +0530 Subject: [PATCH 1/7] Decouple geospatial support from complex datatype flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit EnableGeoSpatialSupport is now independent of EnableComplexDatatypeSupport. Previously, geospatial required complex datatypes to be enabled, which was an unnecessary coupling — geospatial types (GEOMETRY, GEOGRAPHY) have their own conversion path and don't depend on complex type handling. Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../jdbc/api/impl/DatabricksConnectionContext.java | 4 +--- .../jdbc/api/internal/IDatabricksConnectionContext.java | 5 +---- .../jdbc/api/impl/arrow/ArrowStreamResultTest.java | 8 +++----- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java b/src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java index 9dc8d4d02a..ea9e15b26d 100644 --- a/src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java +++ b/src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java @@ -995,9 +995,7 @@ public boolean isComplexDatatypeSupportEnabled() { @Override public boolean isGeoSpatialSupportEnabled() { - // Geospatial support requires complex datatype support to be enabled - return isComplexDatatypeSupportEnabled() - && getParameter(DatabricksJdbcUrlParams.ENABLE_GEOSPATIAL_SUPPORT).equals("1"); + return getParameter(DatabricksJdbcUrlParams.ENABLE_GEOSPATIAL_SUPPORT).equals("1"); } @Override diff --git a/src/main/java/com/databricks/jdbc/api/internal/IDatabricksConnectionContext.java b/src/main/java/com/databricks/jdbc/api/internal/IDatabricksConnectionContext.java index 71ab0ab585..83867e2673 100644 --- a/src/main/java/com/databricks/jdbc/api/internal/IDatabricksConnectionContext.java +++ b/src/main/java/com/databricks/jdbc/api/internal/IDatabricksConnectionContext.java @@ -308,10 +308,7 @@ public interface IDatabricksConnectionContext { /** Returns true if driver return complex data type java objects natively as opposed to string */ boolean isComplexDatatypeSupportEnabled(); - /** - * Returns true if driver returns GEOMETRY and GEOGRAPHY types natively. Requires - * isComplexDatatypeSupportEnabled() to be true - */ + /** Returns true if driver returns GEOMETRY and GEOGRAPHY types natively. */ boolean isGeoSpatialSupportEnabled(); /** Returns the size for HTTP connection pool */ diff --git a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java index 3ede51f430..299b529ba8 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java @@ -410,18 +410,16 @@ public void testGeospatialTypeWithBothFlagsEnabled() throws Exception { } @Test - public void testGeospatialSupportRequiresComplexDatatypeSupport() throws Exception { - // Test that EnableGeoSpatialSupport=1 alone (without EnableComplexDatatypeSupport) doesn't - // enable geospatial + public void testGeospatialSupportIndependentOfComplexDatatypeSupport() throws Exception { + // Geospatial support is independent of complex datatype support — can be enabled alone Properties props = new Properties(); props.setProperty("EnableComplexDatatypeSupport", "0"); props.setProperty("EnableGeoSpatialSupport", "1"); IDatabricksConnectionContext connectionContext = DatabricksConnectionContextFactory.create(JDBC_URL, props); - // Verify that geospatial support is disabled because complex datatype support is disabled assertFalse(connectionContext.isComplexDatatypeSupportEnabled()); - assertFalse(connectionContext.isGeoSpatialSupportEnabled()); + assertTrue(connectionContext.isGeoSpatialSupportEnabled()); } @Test From 056a4ac2b244d1c34318a434745ca50fddc99479 Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Tue, 5 May 2026 15:21:25 +0530 Subject: [PATCH 2/7] Fix handleComplexDataTypes to not gate geospatial on complexDatatypeSupport DatabricksTypeUtil.isComplexType() includes GEOMETRY/GEOGRAPHY, so geospatial values route through handleComplexDataTypes(). Without this fix, enabling geospatial but disabling complex datatypes would cause geospatial objects to be toString()'d at the complexDatatypeSupport gate. Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../com/databricks/jdbc/api/impl/DatabricksResultSet.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java b/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java index f9a73208ef..99278d700c 100644 --- a/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java +++ b/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java @@ -546,6 +546,10 @@ private Object handleComplexDataTypes(Object obj, String columnName) if (resultSetType == ResultSetType.SEA_INLINE) { obj = convertToComplexDataTypesForSEAInline(obj, columnName); } + // Geospatial types have their own flag — don't gate on complexDatatypeSupport + if (isGeospatialType(columnName)) { + return obj; + } return complexDatatypeSupport ? obj : obj.toString(); } From 83a2c10c64c6ae26f7b8aecf9bb14b81083d1611 Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Tue, 5 May 2026 15:25:41 +0530 Subject: [PATCH 3/7] Add tests for geospatial flag independence from complex datatype flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5 tests covering all combinations: - Geospatial=1 + Complex=0 → geospatial enabled, complex disabled - Geospatial=0 + Complex=1 → geospatial disabled, complex enabled - Both=1 → both enabled - Both=0 → both disabled - Neither set → both default to disabled Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../impl/DatabricksConnectionContextTest.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/test/java/com/databricks/jdbc/api/impl/DatabricksConnectionContextTest.java b/src/test/java/com/databricks/jdbc/api/impl/DatabricksConnectionContextTest.java index cc61fad69b..3be5ae52fe 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/DatabricksConnectionContextTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/DatabricksConnectionContextTest.java @@ -1488,6 +1488,59 @@ public void testUseQueryForMetadataExplicitFalseOnWarehouse() throws DatabricksS assertFalse(ctx.useQueryForMetadata()); } + // --------------------------------------------------------------------------- + // Geospatial flag independence from complex datatype flag + // --------------------------------------------------------------------------- + + @Test + public void testGeospatialEnabled_complexDisabled() throws DatabricksSQLException { + IDatabricksConnectionContext ctx = + DatabricksConnectionContext.parse( + TestConstants.VALID_URL_1 + ";EnableGeoSpatialSupport=1;EnableComplexDatatypeSupport=0", + properties); + assertTrue(ctx.isGeoSpatialSupportEnabled()); + assertFalse(ctx.isComplexDatatypeSupportEnabled()); + } + + @Test + public void testGeospatialDisabled_complexEnabled() throws DatabricksSQLException { + IDatabricksConnectionContext ctx = + DatabricksConnectionContext.parse( + TestConstants.VALID_URL_1 + ";EnableGeoSpatialSupport=0;EnableComplexDatatypeSupport=1", + properties); + assertFalse(ctx.isGeoSpatialSupportEnabled()); + assertTrue(ctx.isComplexDatatypeSupportEnabled()); + } + + @Test + public void testGeospatialAndComplexBothEnabled() throws DatabricksSQLException { + IDatabricksConnectionContext ctx = + DatabricksConnectionContext.parse( + TestConstants.VALID_URL_1 + ";EnableGeoSpatialSupport=1;EnableComplexDatatypeSupport=1", + properties); + assertTrue(ctx.isGeoSpatialSupportEnabled()); + assertTrue(ctx.isComplexDatatypeSupportEnabled()); + } + + @Test + public void testGeospatialAndComplexBothDisabled() throws DatabricksSQLException { + IDatabricksConnectionContext ctx = + DatabricksConnectionContext.parse( + TestConstants.VALID_URL_1 + ";EnableGeoSpatialSupport=0;EnableComplexDatatypeSupport=0", + properties); + assertFalse(ctx.isGeoSpatialSupportEnabled()); + assertFalse(ctx.isComplexDatatypeSupportEnabled()); + } + + @Test + public void testGeospatialDefaultDisabled() throws DatabricksSQLException { + // Neither flag set — both default to disabled + IDatabricksConnectionContext ctx = + DatabricksConnectionContext.parse(TestConstants.VALID_URL_1, properties); + assertFalse(ctx.isGeoSpatialSupportEnabled()); + assertFalse(ctx.isComplexDatatypeSupportEnabled()); + } + // --------------------------------------------------------------------------- // Client type selection with Thrift-native metadata params // --------------------------------------------------------------------------- From 22d6f8f5cfc29483a523f776fdb5015de3ca7ad4 Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Wed, 6 May 2026 15:54:47 +0530 Subject: [PATCH 4/7] Address review: remove geospatial from isComplexType, add independent handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove GEOMETRY/GEOGRAPHY from isComplexType() in DatabricksTypeUtil and ArrowStreamResult — geospatial types are not complex types - Add isGeospatialType() utility in DatabricksTypeUtil - Add independent geospatial handling in DatabricksResultSet.getObject() via new handleGeospatialType() and convertGeospatialForSEAInline() - Remove geospatial branches from convertToComplexDataTypesForSEAInline() - Update DatabricksThriftUtil to check both isComplexType and isGeospatialType for arrow metadata detection - Update param description to remove complex datatype dependency claim - Fix duplicate isGeospatialType in ArrowStreamResult - Update tests to assert geospatial is NOT a complex type Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../jdbc/api/impl/DatabricksResultSet.java | 33 +++++++++++++------ .../api/impl/arrow/ArrowStreamResult.java | 4 +-- .../jdbc/common/DatabricksJdbcUrlParams.java | 2 +- .../common/util/DatabricksThriftUtil.java | 3 +- .../jdbc/common/util/DatabricksTypeUtil.java | 22 ++++++++----- .../api/impl/arrow/ArrowStreamResultTest.java | 11 +++++-- 6 files changed, 49 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java b/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java index 99278d700c..a83956528e 100644 --- a/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java +++ b/src/main/java/com/databricks/jdbc/api/impl/DatabricksResultSet.java @@ -526,6 +526,10 @@ public Object getObject(int columnIndex) throws SQLException { } int columnType = resultSetMetaData.getColumnType(columnIndex); String columnTypeName = resultSetMetaData.getColumnTypeName(columnIndex); + // Geospatial types: handle independently of complex datatype flag + if (isGeospatialType(columnTypeName)) { + return handleGeospatialType(obj, columnTypeName); + } // separate handling for complex data types if (isComplexType(columnTypeName)) { return handleComplexDataTypes(obj, columnTypeName); @@ -541,15 +545,30 @@ public Object getObject(int columnIndex) throws SQLException { return ConverterHelper.convertSqlTypeToJavaType(columnType, obj); } + private Object handleGeospatialType(Object obj, String columnName) throws DatabricksSQLException { + if (resultSetType == ResultSetType.SEA_INLINE) { + obj = convertGeospatialForSEAInline(obj, columnName); + } + return obj; + } + + private Object convertGeospatialForSEAInline(Object obj, String columnName) + throws DatabricksSQLException { + if (columnName.startsWith(GEOMETRY)) { + return ConverterHelper.getConverterForColumnType(Types.OTHER, GEOMETRY) + .toDatabricksGeometry(obj); + } else if (columnName.startsWith(GEOGRAPHY)) { + return ConverterHelper.getConverterForColumnType(Types.OTHER, GEOGRAPHY) + .toDatabricksGeography(obj); + } + return obj; + } + private Object handleComplexDataTypes(Object obj, String columnName) throws DatabricksSQLException { if (resultSetType == ResultSetType.SEA_INLINE) { obj = convertToComplexDataTypesForSEAInline(obj, columnName); } - // Geospatial types have their own flag — don't gate on complexDatatypeSupport - if (isGeospatialType(columnName)) { - return obj; - } return complexDatatypeSupport ? obj : obj.toString(); } @@ -562,12 +581,6 @@ private Object convertToComplexDataTypesForSEAInline(Object obj, String columnNa return parser.parseJsonStringToDbMap(obj.toString(), columnName); } else if (columnName.startsWith(STRUCT)) { return parser.parseJsonStringToDbStruct(obj.toString(), columnName); - } else if (columnName.startsWith(GEOMETRY)) { - return ConverterHelper.getConverterForColumnType(Types.OTHER, GEOMETRY) - .toDatabricksGeometry(obj); - } else if (columnName.startsWith(GEOGRAPHY)) { - return ConverterHelper.getConverterForColumnType(Types.OTHER, GEOGRAPHY) - .toDatabricksGeography(obj); } throw new DatabricksParsingException( "Unexpected metadata format. Type is not a COMPLEX: " + columnName, diff --git a/src/main/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResult.java b/src/main/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResult.java index a10de8e1e3..1569b7efb8 100644 --- a/src/main/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResult.java +++ b/src/main/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResult.java @@ -253,9 +253,7 @@ public Object getObject(int columnIndex) throws DatabricksSQLException { public static boolean isComplexType(ColumnInfoTypeName type) { return type == ColumnInfoTypeName.ARRAY || type == ColumnInfoTypeName.MAP - || type == ColumnInfoTypeName.STRUCT - || type == ColumnInfoTypeName.GEOMETRY - || type == ColumnInfoTypeName.GEOGRAPHY; + || type == ColumnInfoTypeName.STRUCT; } /** diff --git a/src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java b/src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java index b67a5023b4..5186764571 100644 --- a/src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java +++ b/src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java @@ -130,7 +130,7 @@ public enum DatabricksJdbcUrlParams { "0"), ENABLE_GEOSPATIAL_SUPPORT( "EnableGeoSpatialSupport", - "flag to enable native support of GEOMETRY and GEOGRAPHY data types. Requires EnableComplexDatatypeSupport=1", + "flag to enable native support of GEOMETRY and GEOGRAPHY data types", "0"), ROWS_FETCHED_PER_BLOCK( "RowsFetchedPerBlock", diff --git a/src/main/java/com/databricks/jdbc/common/util/DatabricksThriftUtil.java b/src/main/java/com/databricks/jdbc/common/util/DatabricksThriftUtil.java index 53a7e383bb..e50e20366f 100644 --- a/src/main/java/com/databricks/jdbc/common/util/DatabricksThriftUtil.java +++ b/src/main/java/com/databricks/jdbc/common/util/DatabricksThriftUtil.java @@ -233,7 +233,8 @@ public static ColumnInfo getColumnInfoFromTColumnDesc( String typeText = getTypeTextFromTypeDesc(columnDesc.getTypeDesc()); - if (arrowMetadata != null && isComplexType(arrowMetadata)) { + if (arrowMetadata != null + && (isComplexType(arrowMetadata) || isGeospatialType(arrowMetadata))) { typeText = arrowMetadata; if (arrowMetadata.startsWith(GEOMETRY)) { columnInfoTypeName = ColumnInfoTypeName.GEOMETRY; diff --git a/src/main/java/com/databricks/jdbc/common/util/DatabricksTypeUtil.java b/src/main/java/com/databricks/jdbc/common/util/DatabricksTypeUtil.java index 6350597185..9d7dce54c6 100644 --- a/src/main/java/com/databricks/jdbc/common/util/DatabricksTypeUtil.java +++ b/src/main/java/com/databricks/jdbc/common/util/DatabricksTypeUtil.java @@ -561,18 +561,22 @@ public static String getDecimalTypeString(BigDecimal bd) { } /** - * Checks if the given type name represents a complex type (ARRAY, MAP, STRUCT, GEOMETRY, or - * GEOGRAPHY). + * Checks if the given type name represents a complex type (ARRAY, MAP, STRUCT). * * @param typeName The type name to check - * @return true if the type name starts with ARRAY, MAP, STRUCT, GEOMETRY, or GEOGRAPHY, false - * otherwise + * @return true if the type name starts with ARRAY, MAP, or STRUCT */ public static boolean isComplexType(String typeName) { - return typeName.startsWith(ARRAY) - || typeName.startsWith(MAP) - || typeName.startsWith(STRUCT) - || typeName.startsWith(GEOMETRY) - || typeName.startsWith(GEOGRAPHY); + return typeName.startsWith(ARRAY) || typeName.startsWith(MAP) || typeName.startsWith(STRUCT); + } + + /** + * Checks if the given type name represents a geospatial type (GEOMETRY, GEOGRAPHY). + * + * @param typeName The type name to check + * @return true if the type name starts with GEOMETRY or GEOGRAPHY + */ + public static boolean isGeospatialType(String typeName) { + return typeName.startsWith(GEOMETRY) || typeName.startsWith(GEOGRAPHY); } } diff --git a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java index 299b529ba8..77e3af448e 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java @@ -195,8 +195,15 @@ public void testComplexTypeHandling() { assertTrue(ArrowStreamResult.isComplexType(ColumnInfoTypeName.ARRAY)); assertTrue(ArrowStreamResult.isComplexType(ColumnInfoTypeName.MAP)); assertTrue(ArrowStreamResult.isComplexType(ColumnInfoTypeName.STRUCT)); - assertTrue(ArrowStreamResult.isComplexType(ColumnInfoTypeName.GEOMETRY)); - assertTrue(ArrowStreamResult.isComplexType(ColumnInfoTypeName.GEOGRAPHY)); + + // Geospatial types are NOT complex types — they have independent handling + assertFalse(ArrowStreamResult.isComplexType(ColumnInfoTypeName.GEOMETRY)); + assertFalse(ArrowStreamResult.isComplexType(ColumnInfoTypeName.GEOGRAPHY)); + + // Geospatial type check is separate + assertTrue(ArrowStreamResult.isGeospatialType(ColumnInfoTypeName.GEOMETRY)); + assertTrue(ArrowStreamResult.isGeospatialType(ColumnInfoTypeName.GEOGRAPHY)); + assertFalse(ArrowStreamResult.isGeospatialType(ColumnInfoTypeName.ARRAY)); // Non-complex types should return false assertFalse(ArrowStreamResult.isComplexType(ColumnInfoTypeName.INT)); From 03ad25ea8465651020d1ae4b2b618bfcd80fa30f Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Thu, 7 May 2026 14:27:30 +0530 Subject: [PATCH 5/7] Address remaining review feedback: update E2E tests and stale comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GeospatialTests: Remove enableComplexSupport from shouldReturnGeospatialObjects condition — geospatial only depends on enableGeoSupport flag - GeospatialTests: Update class Javadoc to reflect independence - ArrowStreamResultTest: Rename testGeospatialTypeWithBothFlagsEnabled to testGeospatialEnabledIndependentlyOfComplexDatatype, test both combos Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../api/impl/arrow/ArrowStreamResultTest.java | 21 ++++++++++++------- .../jdbc/integration/e2e/GeospatialTests.java | 10 ++++----- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java index 77e3af448e..8ce140153a 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java @@ -403,17 +403,22 @@ public void testGeospatialTypeWithGeoSpatialSupportDisabled() throws Exception { } @Test - public void testGeospatialTypeWithBothFlagsEnabled() throws Exception { - // Setup connection context with both complex datatype and geospatial support enabled + public void testGeospatialEnabledIndependentlyOfComplexDatatype() throws Exception { + // Geospatial can be enabled with or without complex datatype support Properties props = new Properties(); props.setProperty("EnableComplexDatatypeSupport", "1"); props.setProperty("EnableGeoSpatialSupport", "1"); - IDatabricksConnectionContext connectionContext = - DatabricksConnectionContextFactory.create(JDBC_URL, props); - - // Verify both flags are enabled - assertTrue(connectionContext.isComplexDatatypeSupportEnabled()); - assertTrue(connectionContext.isGeoSpatialSupportEnabled()); + IDatabricksConnectionContext ctx1 = DatabricksConnectionContextFactory.create(JDBC_URL, props); + assertTrue(ctx1.isComplexDatatypeSupportEnabled()); + assertTrue(ctx1.isGeoSpatialSupportEnabled()); + + // Geospatial enabled without complex datatypes + Properties props2 = new Properties(); + props2.setProperty("EnableComplexDatatypeSupport", "0"); + props2.setProperty("EnableGeoSpatialSupport", "1"); + IDatabricksConnectionContext ctx2 = DatabricksConnectionContextFactory.create(JDBC_URL, props2); + assertFalse(ctx2.isComplexDatatypeSupportEnabled()); + assertTrue(ctx2.isGeoSpatialSupportEnabled()); } @Test diff --git a/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java b/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java index 8b3bf9e4de..a84637983f 100644 --- a/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java +++ b/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java @@ -19,9 +19,9 @@ * (Thrift/SEA), Serialization (Arrow/Inline), CloudFetch, GeoSpatial support, and Complex type * support. * - *

Geospatial objects (IGeometry/IGeography) are returned only when both EnableGeoSpatialSupport - * and EnableComplexDatatypeSupport are enabled AND not in Thrift+Inline mode. Otherwise, returns as - * STRING. + *

Geospatial objects (IGeometry/IGeography) are returned when EnableGeoSpatialSupport is enabled + * AND not in Thrift+Inline mode. EnableComplexDatatypeSupport is independent and not required. + * Otherwise, returns as STRING. */ public class GeospatialTests { @@ -138,10 +138,10 @@ void testGeospatialPoint( assertTrue(rs.next(), "Should have at least one row for config: " + desc); // Geospatial objects returned only when: - // 1. Both EnableGeoSpatialSupport=1 AND EnableComplexDatatypeSupport=1 + // 1. EnableGeoSpatialSupport=1 (independent of EnableComplexDatatypeSupport) // 2. NOT in Thrift + Inline mode (Thrift doesn't support geospatial without Arrow) boolean shouldReturnGeospatialObjects = - enableGeoSupport == 1 && enableComplexSupport == 1 && !(useThrift == 1 && enableArrow == 0); + enableGeoSupport == 1 && !(useThrift == 1 && enableArrow == 0); if (shouldReturnGeospatialObjects) { validateGeospatialEnabled(rs, rsm); From 28ebcbe0a9d09dc3fa2e288a419b44e7a611656a Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Thu, 7 May 2026 14:41:29 +0530 Subject: [PATCH 6/7] Fix remaining stale comments and missed E2E logic for flag independence - GeospatialTests: fix second shouldReturnGeospatialObjects in testGeometryAny that still had enableComplexSupport check - ArrowStreamResultTest: update comment to clarify flags are independent - DatabricksResultSetMetaDataTest: update comment to clarify independence - InlineJsonResultTest: update comment to clarify independence Co-authored-by: Isaac Signed-off-by: Gopal Lal --- .../jdbc/api/impl/DatabricksResultSetMetaDataTest.java | 6 +++--- .../com/databricks/jdbc/api/impl/InlineJsonResultTest.java | 6 +++--- .../jdbc/api/impl/arrow/ArrowStreamResultTest.java | 4 ++-- .../databricks/jdbc/integration/e2e/GeospatialTests.java | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/test/java/com/databricks/jdbc/api/impl/DatabricksResultSetMetaDataTest.java b/src/test/java/com/databricks/jdbc/api/impl/DatabricksResultSetMetaDataTest.java index 51474e21a5..0485e96a83 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/DatabricksResultSetMetaDataTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/DatabricksResultSetMetaDataTest.java @@ -765,9 +765,9 @@ public void testJsonArrayFormatMetadataWithGeospatialFlagDisabled() throws SQLEx @Test public void testJsonArrayWithComplexTypesEnabledButGeospatialDisabled() throws SQLException { - // This test validates the important scenario where EnableComplexDatatypeSupport=1 - // but EnableGeoSpatialSupport=0 (disabled). This simulates real-world usage where - // users want complex types (ARRAY, MAP, STRUCT) but want geospatial data as strings. + // This test validates that with EnableGeoSpatialSupport=0, geospatial columns + // report as STRING in metadata regardless of the EnableComplexDatatypeSupport setting. + // The two flags are independent. // // Expected behavior: // - GEOMETRY/GEOGRAPHY column types should report as STRING in metadata diff --git a/src/test/java/com/databricks/jdbc/api/impl/InlineJsonResultTest.java b/src/test/java/com/databricks/jdbc/api/impl/InlineJsonResultTest.java index 1d8c3386be..13e376153b 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/InlineJsonResultTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/InlineJsonResultTest.java @@ -367,9 +367,9 @@ void testJsonArrayFormatWithGeospatialTypesWhenFlagEnabled() throws DatabricksSQ @Test void testJsonArrayWithComplexTypesEnabledButGeospatialDisabled() throws DatabricksSQLException { - // This test validates the scenario where EnableComplexDatatypeSupport=1 but - // EnableGeoSpatialSupport=0 (disabled). This simulates a real-world scenario where - // users enable complex types for ARRAY/MAP/STRUCT but want geospatial data as strings. + // This test validates that with EnableGeoSpatialSupport=0, geospatial columns + // return as strings regardless of EnableComplexDatatypeSupport setting. + // The two flags are independent. // // Expected behavior: // - Geospatial column TYPES in metadata should report as STRING diff --git a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java index 8ce140153a..e52404953d 100644 --- a/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java +++ b/src/test/java/com/databricks/jdbc/api/impl/arrow/ArrowStreamResultTest.java @@ -345,8 +345,8 @@ private Schema createTestSchema() { @Test public void testGeospatialTypeWithGeoSpatialSupportDisabled() throws Exception { - // Setup connection context with geospatial support disabled - // (EnableComplexDatatypeSupport=1, but EnableGeoSpatialSupport=0) + // Setup connection context with geospatial support disabled (EnableGeoSpatialSupport=0) + // Complex datatype flag is independent and has no effect on geospatial behavior Properties props = new Properties(); props.setProperty("EnableComplexDatatypeSupport", "1"); props.setProperty("EnableGeoSpatialSupport", "0"); diff --git a/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java b/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java index a84637983f..65e255ff62 100644 --- a/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java +++ b/src/test/java/com/databricks/jdbc/integration/e2e/GeospatialTests.java @@ -193,10 +193,10 @@ void testGeometryAny( } // Geospatial objects returned only when: - // 1. Both EnableGeoSpatialSupport=1 AND EnableComplexDatatypeSupport=1 + // 1. EnableGeoSpatialSupport=1 (independent of EnableComplexDatatypeSupport) // 2. NOT in Thrift + Inline mode boolean shouldReturnGeospatialObjects = - enableGeoSupport == 1 && enableComplexSupport == 1 && !(useThrift == 1 && enableArrow == 0); + enableGeoSupport == 1 && !(useThrift == 1 && enableArrow == 0); if (shouldReturnGeospatialObjects) { validateGeometryAnyEnabled(rs, rsm); From 5e3bfe12d28e28a5110d10e1c019ffc7e32f2462 Mon Sep 17 00:00:00 2001 From: Gopal Lal Date: Thu, 7 May 2026 16:02:05 +0530 Subject: [PATCH 7/7] Add changelog entry for geospatial flag independence Co-authored-by: Isaac Signed-off-by: Gopal Lal --- NEXT_CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index d27a25e263..ac81de5d96 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -5,6 +5,7 @@ ### Added ### Updated +- `EnableGeoSpatialSupport` no longer requires `EnableComplexDatatypeSupport=1`. Geospatial types (GEOMETRY, GEOGRAPHY) can now be enabled independently of complex type support (ARRAY, MAP, STRUCT). ### Fixed