Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Aug 1, 2024
1 parent 326e7c3 commit ba4c50a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public MediaType contentType() {
@Override
public long contentLength() {
return fileSize; // return the actual file size
// return inputStream.available() == 0 ? -1 : inputStream.available();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private Connection createConnection()
throws SQLException {
String url = "jdbc:databend://localhost:8000/default";
return DriverManager.getConnection(url, "databend", "databend");

}

private Connection createConnection(boolean presignDisabled) throws SQLException {
Expand Down Expand Up @@ -84,6 +85,28 @@ private String generateRandomCSV(int lines) {
return csvPath;
}

private String generateLargeCSV() {
String tmpDir = System.getProperty("java.io.tmpdir");
String csvPath = tmpDir + "/large_test.csv";
long fileSizeInBytes = 0;
File f = new File(csvPath);
try {
FileWriter writer = new FileWriter(f);
while (fileSizeInBytes < 2L * 1024 * 1024 * 1024) { // 2GB
for (int i = 0; i < 1000; i++) { // write 1000 lines at a time
int num = (int) (Math.random() * 1000);
writer.write("a,b,c," + num + "\n");
}
writer.flush();
fileSizeInBytes = f.length();
}
writer.close();
} catch (Exception e) {
throw new RuntimeException(e);
}
return csvPath;
}

private String generateRandomCSVComplex(int lines) {
if (lines <= 0) {
return "";
Expand Down

0 comments on commit ba4c50a

Please sign in to comment.