Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1846830 allow triple slash file prefix (file:///) #2033

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ private void uploadFiles(Set<String> fileList, int parallel) throws SnowflakeSQL
threadExecutor.submit(
getUploadFileCallable(
stageInfo,
srcFile,
srcFileObj.getPath(),
fileMetadata,
(stageInfo.getStageType() == StageInfo.StageType.LOCAL_FS)
? null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,4 +871,29 @@ public void testUploadWithTildeInPath() throws SQLException, IOException {
FileUtils.deleteDirectory(subDir.toFile());
}
}

@Test
public void testUploadWithTripleSlashFilePrefix() throws SQLException {
try (Connection connection = getConnection();
Statement statement = connection.createStatement()) {
try {
statement.execute("CREATE OR REPLACE STAGE testStage");
sfc-gh-mkubik marked this conversation as resolved.
Show resolved Hide resolved
SFSession sfSession = connection.unwrap(SnowflakeConnectionV1.class).getSfSession();

String command = "PUT file:///" + getFullPathFileInResource(TEST_DATA_FILE) + " @testStage";
SnowflakeFileTransferAgent sfAgent =
new SnowflakeFileTransferAgent(command, sfSession, new SFStatement(sfSession));
assertTrue(sfAgent.execute());

String getCommand = "GET @testStage file:///tmp";
sfc-gh-mkubik marked this conversation as resolved.
Show resolved Hide resolved
SnowflakeFileTransferAgent sfAgent1 =
new SnowflakeFileTransferAgent(getCommand, sfSession, new SFStatement(sfSession));
assertTrue(sfAgent1.execute());
assertEquals(1, sfAgent1.statusRows.size());
} finally {
statement.execute("DROP STAGE if exists testStage");
}
}
SnowflakeFileTransferAgent.setInjectedFileTransferException(null);
sfc-gh-mkubik marked this conversation as resolved.
Show resolved Hide resolved
}
}