Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fixed `setCatalog()` and `setSchema()` producing invalid SQL (e.g. `SET CATALOG ``name``) when the catalog or schema name was passed already wrapped in backticks. Backticks are now stripped before wrapping, and `getCatalog()`/`getSchema()` return the bare identifier name.
- Fixed metadata SQL generation for catalog, schema, and table identifiers containing backticks.
- Fixed SEA result truncation when direct results are disabled. Large, highly-compressible results that span multiple chunks were delivered inline via the old hybrid path and truncated to the first chunk. The SQL Execution path now uses an async (`0s`) wait timeout when direct results are disabled, so results are returned via external links and fetched in full.
- Fixed `DatabricksDatabaseMetaData.supportsBatchUpdates()` always returning `false`, which caused batch-aware JDBC clients (e.g. Apache Hop) to skip `executeBatch()` and fall back to one INSERT per row. It now returns `true` when `EnableBatchedInserts=1`, so those clients use the optimized multi-row INSERT path.

---
*Note: When making changes, please add your change under the appropriate section
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,9 @@ public boolean insertsAreDetected(int type) throws SQLException {
public boolean supportsBatchUpdates() throws SQLException {
LOGGER.debug("public boolean supportsBatchUpdates()");
throwExceptionIfConnectionIsClosed();
return false;
// Advertise batch support only when the multi-row INSERT optimization is enabled, so
// batch-aware clients use executeBatch() instead of one executeUpdate() per row.
return session.getConnectionContext().isBatchedInsertsEnabled();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,21 @@ public void getDatabaseProductName_throwsExceptionWhenConnectionIsClosed() throw
}

@Test
public void supportsBatchUpdates_returnsFalse() throws Exception {
public void supportsBatchUpdates_returnsFalseByDefault() throws Exception {
// Default EnableBatchedInserts=0, so batch support is not advertised
boolean supportsBatchUpdates = metaData.supportsBatchUpdates();
assertFalse(supportsBatchUpdates);
}

@Test
public void supportsBatchUpdates_returnsTrueWhenBatchedInsertsEnabled() throws Exception {
String urlWithBatchedInserts = WAREHOUSE_JDBC_URL + ";EnableBatchedInserts=1";
when(session.getConnectionContext())
.thenReturn(DatabricksConnectionContext.parse(urlWithBatchedInserts, new Properties()));
boolean supportsBatchUpdates = metaData.supportsBatchUpdates();
assertTrue(supportsBatchUpdates);
}

@Test
public void getDatabaseMajorVersion_returnsCorrectVersion() throws Exception {
int majorVersion = metaData.getDatabaseMajorVersion();
Expand Down
Loading