File tree 1 file changed +8
-0
lines changed
dqops/src/main/java/com/dqops/connectors/duckdb
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 44
44
import tech .tablesaw .api .Table ;
45
45
import tech .tablesaw .columns .Column ;
46
46
47
+ import java .nio .file .Files ;
48
+ import java .nio .file .Path ;
47
49
import java .sql .ResultSet ;
48
50
import java .sql .SQLException ;
49
51
import java .sql .Statement ;
@@ -64,6 +66,7 @@ public class DuckdbSourceConnection extends AbstractJdbcSourceConnection {
64
66
private final DqoDuckdbConfiguration dqoDuckdbConfiguration ;
65
67
private static final Object settingsExecutionLock = new Object ();
66
68
private static final boolean settingsConfigured = false ;
69
+ private static final String temporaryDirectoryPrefix = "dqops_duckdb_temp_" ;
67
70
68
71
/**
69
72
* Injection constructor for the duckdb connection.
@@ -195,6 +198,11 @@ private void configureSettings(){
195
198
196
199
String threadsQuery = "SET GLOBAL threads = " + dqoDuckdbConfiguration .getThreads ();
197
200
this .executeCommand (threadsQuery , JobCancellationToken .createDummyJobCancellationToken ());
201
+
202
+ String temporaryDirectory = Files .createTempDirectory (temporaryDirectoryPrefix ).toFile ().getAbsolutePath ();
203
+ Path .of (temporaryDirectory ).toFile ().deleteOnExit ();
204
+ String tempDirectoryQuery = "SET temp_directory = " + temporaryDirectory ;
205
+ this .executeCommand (tempDirectoryQuery , JobCancellationToken .createDummyJobCancellationToken ());
198
206
}
199
207
} catch (Exception e ) {
200
208
throw new RuntimeException (e );
You can’t perform that action at this time.
0 commit comments