@@ -80,8 +80,6 @@ public class SnowflakeFileTransferAgent extends SFBaseFileTransferAgent {
80
80
private static final SFLogger logger =
81
81
SFLoggerFactory .getLogger (SnowflakeFileTransferAgent .class );
82
82
83
- static final StorageClientFactory storageFactory = StorageClientFactory .getFactory ();
84
-
85
83
private static final ObjectMapper mapper = ObjectMapperFactory .getObjectMapper ();
86
84
87
85
// We will allow buffering of upto 128M data before spilling to disk during
@@ -891,7 +889,8 @@ public SnowflakeFileTransferAgent(String command, SFSession session, SFStatement
891
889
parseCommand ();
892
890
893
891
if (stageInfo .getStageType () != StageInfo .StageType .LOCAL_FS ) {
894
- storageClient = storageFactory .createClient (stageInfo , parallel , null , session );
892
+ storageClient =
893
+ StorageClientFactory .getFactory ().createClient (stageInfo , parallel , null , session );
895
894
}
896
895
}
897
896
@@ -1627,7 +1626,8 @@ private void uploadStream() throws SnowflakeSQLException {
1627
1626
fileMetadata ,
1628
1627
(stageInfo .getStageType () == StageInfo .StageType .LOCAL_FS )
1629
1628
? null
1630
- : storageFactory .createClient (stageInfo , parallel , encMat , session ),
1629
+ : StorageClientFactory .getFactory ()
1630
+ .createClient (stageInfo , parallel , encMat , session ),
1631
1631
session ,
1632
1632
command ,
1633
1633
sourceStream ,
@@ -1728,7 +1728,7 @@ public InputStream downloadStream(String fileName) throws SnowflakeSQLException
1728
1728
RemoteStoreFileEncryptionMaterial encMat = srcFileToEncMat .get (sourceLocation );
1729
1729
String presignedUrl = srcFileToPresignedUrl .get (sourceLocation );
1730
1730
1731
- return storageFactory
1731
+ return StorageClientFactory . getFactory ()
1732
1732
.createClient (stageInfo , parallel , encMat , session )
1733
1733
.downloadToStream (
1734
1734
session ,
@@ -1772,7 +1772,8 @@ private void downloadFiles() throws SnowflakeSQLException {
1772
1772
fileMetadataMap ,
1773
1773
(stageInfo .getStageType () == StageInfo .StageType .LOCAL_FS )
1774
1774
? null
1775
- : storageFactory .createClient (stageInfo , parallel , encMat , session ),
1775
+ : StorageClientFactory .getFactory ()
1776
+ .createClient (stageInfo , parallel , encMat , session ),
1776
1777
session ,
1777
1778
command ,
1778
1779
parallel ,
@@ -1878,8 +1879,8 @@ private void uploadFiles(Set<String> fileList, int parallel) throws SnowflakeSQL
1878
1879
fileMetadata ,
1879
1880
(stageInfo .getStageType () == StageInfo .StageType .LOCAL_FS )
1880
1881
? null
1881
- : storageFactory . createClient (
1882
- stageInfo , parallel , encryptionMaterial .get (0 ), session ),
1882
+ : StorageClientFactory . getFactory ()
1883
+ . createClient ( stageInfo , parallel , encryptionMaterial .get (0 ), session ),
1883
1884
session ,
1884
1885
command ,
1885
1886
null ,
@@ -2174,7 +2175,8 @@ private static void pushFileToRemoteStore(
2174
2175
(ArgSupplier )
2175
2176
() -> (encMat == null ? "NULL" : encMat .getSmkId () + "|" + encMat .getQueryId ()));
2176
2177
2177
- StorageObjectMetadata meta = storageFactory .createStorageMetadataObj (stage .getStageType ());
2178
+ StorageObjectMetadata meta =
2179
+ StorageClientFactory .getFactory ().createStorageMetadataObj (stage .getStageType ());
2178
2180
meta .setContentLength (uploadSize );
2179
2181
if (digest != null ) {
2180
2182
initialClient .addDigestMetadata (meta , digest );
@@ -2312,7 +2314,7 @@ public static void uploadWithoutConnection(SnowflakeFileTransferConfig config) t
2312
2314
uploadSize );
2313
2315
2314
2316
SnowflakeStorageClient initialClient =
2315
- storageFactory .createClient (stageInfo , 1 , encMat , /* session= */ null );
2317
+ StorageClientFactory . getFactory () .createClient (stageInfo , 1 , encMat , /* session= */ null );
2316
2318
2317
2319
// Normal flow will never hit here. This is only for testing purposes
2318
2320
if (isInjectedFileTransferExceptionEnabled ()) {
@@ -2428,7 +2430,8 @@ private static void pushFileToRemoteStoreWithPresignedUrl(
2428
2430
(ArgSupplier )
2429
2431
() -> (encMat == null ? "NULL" : encMat .getSmkId () + "|" + encMat .getQueryId ()));
2430
2432
2431
- StorageObjectMetadata meta = storageFactory .createStorageMetadataObj (stage .getStageType ());
2433
+ StorageObjectMetadata meta =
2434
+ StorageClientFactory .getFactory ().createStorageMetadataObj (stage .getStageType ());
2432
2435
meta .setContentLength (uploadSize );
2433
2436
if (digest != null ) {
2434
2437
initialClient .addDigestMetadata (meta , digest );
0 commit comments