Skip to content

Commit 160deae

Browse files
authored
[PECOBLR-348] Added putFiles method in DBFSVolume client (#860)
1 parent d76769d commit 160deae

116 files changed

Lines changed: 5315 additions & 122 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NEXT_CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66
- Added DCO (Developer Certificate of Origin) check workflow for pull requests to ensure all commits are properly signed-off
77
- Added support for SSL client certificate authentication via parameter: SSLTrustStoreProvider
8+
- Added putFiles methods in DBFSVolumeClient for async multi-file upload.
89

910
### Updated
1011
- Column name support for JDBC ResultSet operations is now case-insensitive

src/main/java/com/databricks/jdbc/api/IDatabricksVolumeClient.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.databricks.jdbc.api;
22

3+
import com.databricks.jdbc.exception.DatabricksSQLFeatureNotSupportedException;
4+
import com.databricks.jdbc.model.client.filesystem.VolumePutResult;
35
import java.io.InputStream;
46
import java.sql.SQLException;
57
import java.util.List;
@@ -162,4 +164,50 @@ boolean putObject(
162164
*/
163165
boolean deleteObject(String catalog, String schema, String volume, String objectPath)
164166
throws SQLException;
167+
168+
/**
169+
* Uploads multiple files from input streams to specified paths within a UC Volume.
170+
*
171+
* @param catalog the catalog name in Unity Catalog
172+
* @param schema the schema name in the specified catalog
173+
* @param volume the volume name in the specified schema
174+
* @param objectPaths the list of destination paths in the volume where the data should be
175+
* uploaded
176+
* @param inputStreams the list of input streams containing the data to upload
177+
* @param contentLengths the list of lengths of the data in bytes
178+
* @param toOverwrite whether to overwrite the objects if they already exist
179+
* @return a list of results indicating the success or failure of each upload operation
180+
* @throws DatabricksSQLFeatureNotSupportedException if the operation is not supported
181+
*/
182+
List<VolumePutResult> putFiles(
183+
String catalog,
184+
String schema,
185+
String volume,
186+
List<String> objectPaths,
187+
List<InputStream> inputStreams,
188+
List<Long> contentLengths,
189+
boolean toOverwrite)
190+
throws DatabricksSQLFeatureNotSupportedException;
191+
192+
/**
193+
* Uploads multiple files from local paths to specified paths within a UC Volume.
194+
*
195+
* @param catalog the catalog name in Unity Catalog
196+
* @param schema the schema name in the specified catalog
197+
* @param volume the volume name in the specified schema
198+
* @param objectPaths the list of destination paths in the volume where the files should be
199+
* uploaded
200+
* @param localPaths the list of local file paths to upload
201+
* @param toOverwrite whether to overwrite the objects if they already exist
202+
* @return a list of results indicating the success or failure of each upload operation
203+
* @throws DatabricksSQLFeatureNotSupportedException if the operation is not supported
204+
*/
205+
List<VolumePutResult> putFiles(
206+
String catalog,
207+
String schema,
208+
String volume,
209+
List<String> objectPaths,
210+
List<String> localPaths,
211+
boolean toOverwrite)
212+
throws DatabricksSQLFeatureNotSupportedException;
165213
}

src/main/java/com/databricks/jdbc/api/impl/DatabricksConnectionContext.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,18 @@ public int getDefaultStringColumnLength() {
813813
}
814814
}
815815

816+
@Override
817+
public int getMaxDBFSConcurrentPresignedRequests() {
818+
try {
819+
return Integer.parseInt(
820+
getParameter(DatabricksJdbcUrlParams.MAX_CONCURRENT_PRESIGNED_REQUESTS));
821+
} catch (NumberFormatException e) {
822+
LOGGER.warn(
823+
"Invalid number format for MaxVolumeOperationConcurrentPresignedRequests. Falling back to default value 50.");
824+
return DEFAULT_MAX_CONCURRENT_PRESIGNED_REQUESTS;
825+
}
826+
}
827+
816828
@Override
817829
public boolean isComplexDatatypeSupportEnabled() {
818830
return getParameter(DatabricksJdbcUrlParams.ENABLE_COMPLEX_DATATYPE_SUPPORT).equals("1");

0 commit comments

Comments
 (0)