Skip to content

Commit 547b38f

Browse files
authored
Enable native geospatial type support by default (#1446)
## Summary - Changes `EnableGeoSpatialSupport` default from `0` to `1` so `getObject()` returns `IGeometry`/`IGeography` instances instead of raw EWKT strings out of the box. - Users can set `EnableGeoSpatialSupport=0` to restore the previous behavior. ## Test plan - [ ] Run `GeospatialTests` E2E suite (all 48 configurations) — verified locally, all pass - [ ] Verified default behavior across all 6 protocol/serialization/CloudFetch combinations: geospatial objects returned in all modes except Thrift+Inline (expected) - [ ] Existing tests unaffected since they explicitly set the flag This pull request and its description were written by Isaac. --------- Signed-off-by: Sreekanth Vadigi <sreekanth.vadigi@databricks.com>
1 parent 58b95bb commit 547b38f

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

NEXT_CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
3. **For DBSQL warehouses, metadata operations are now powered by SHOW SQL commands.** SQL Exec API mode already was powered by SHOW commands, now the same is true for Thrift server mode as well. To revert to native Thrift metadata RPCs, set `UseQueryForMetadata` to `0`.
1212

13+
4. **Native geospatial type support (`GEOMETRY` and `GEOGRAPHY`) is now enabled by default.** `getObject()` now returns `IGeometry`/`IGeography` instances instead of EWKT strings. Set `EnableGeoSpatialSupport=0` to restore the previous behavior.
14+
1315
### Added
1416

1517
### Updated

src/main/java/com/databricks/jdbc/common/DatabricksJdbcUrlParams.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public enum DatabricksJdbcUrlParams {
131131
ENABLE_GEOSPATIAL_SUPPORT(
132132
"EnableGeoSpatialSupport",
133133
"flag to enable native support of GEOMETRY and GEOGRAPHY data types",
134-
"0"),
134+
"1"),
135135
ROWS_FETCHED_PER_BLOCK(
136136
"RowsFetchedPerBlock",
137137
"The maximum number of rows that a query returns at a time.",

src/test/java/com/databricks/jdbc/api/impl/DatabricksConnectionContextTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,11 +1618,11 @@ public void testGeospatialAndComplexBothDisabled() throws DatabricksSQLException
16181618
}
16191619

16201620
@Test
1621-
public void testGeospatialDefaultDisabled() throws DatabricksSQLException {
1622-
// Neither flag set — both default to disabled
1621+
public void testGeospatialDefaultEnabled() throws DatabricksSQLException {
1622+
// Neither flag set — geospatial defaults to enabled, complex datatypes to disabled
16231623
IDatabricksConnectionContext ctx =
16241624
DatabricksConnectionContext.parse(TestConstants.VALID_URL_1, properties);
1625-
assertFalse(ctx.isGeoSpatialSupportEnabled());
1625+
assertTrue(ctx.isGeoSpatialSupportEnabled());
16261626
assertFalse(ctx.isComplexDatatypeSupportEnabled());
16271627
}
16281628

src/test/java/com/databricks/jdbc/integration/fakeservice/tests/DataTypesIntegrationTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,11 @@ void testGeospatialTypes() throws SQLException {
361361
rs, "ResultSet should not be null - GEOMETRY/GEOGRAPHY types may not be supported");
362362
ResultSetMetaData rsmd = rs.getMetaData();
363363

364-
// Validate metadata
365-
assertEquals("STRING", rsmd.getColumnTypeName(2));
366-
assertEquals("STRING", rsmd.getColumnTypeName(3));
364+
// Validate metadata — geospatial support is enabled by default
365+
// ST_GeomFromText without SRID → GEOMETRY(0); ST_GeogFromText defaults to WGS 84 →
366+
// GEOGRAPHY(4326)
367+
assertEquals("GEOMETRY(0)", rsmd.getColumnTypeName(2));
368+
assertEquals("GEOGRAPHY(4326)", rsmd.getColumnTypeName(3));
367369

368370
// Validate data
369371
int rowCount = 0;

0 commit comments

Comments
 (0)