6
6
import static io .tiledb .java .api .QueryType .TILEDB_WRITE ;
7
7
8
8
import java .io .File ;
9
+ import java .math .BigInteger ;
9
10
import java .nio .file .Files ;
10
11
import java .nio .file .Paths ;
11
12
import java .util .HashMap ;
@@ -49,6 +50,23 @@ public void testConsolidate() throws Exception {
49
50
arrayRead ();
50
51
}
51
52
53
+ @ Test
54
+ public void testConsolidateStartEnd () throws Exception {
55
+ Config config = new Config ();
56
+ config .set ("sm.consolidation.timestamp_start" , "20" );
57
+ config .set ("sm.consolidation.timestamp_end" , "30" );
58
+ ctx = new Context (config );
59
+ arrayCreate ();
60
+ // updates
61
+ arrayWrite1 ();
62
+ arrayWrite2 ();
63
+ arrayWrite3 ();
64
+ // consolidate
65
+ Array .consolidate (ctx , arrayURI );
66
+ // verify consolidation
67
+ arrayRead ();
68
+ }
69
+
52
70
@ Test
53
71
public void testVacuum () throws Exception {
54
72
// create array
@@ -76,6 +94,37 @@ public void testVacuum() throws Exception {
76
94
Assert .assertEquals (1 , nFiles );
77
95
}
78
96
97
+ @ Test
98
+ public void testVacuumStartEnd () throws Exception {
99
+ Config config = new Config ();
100
+ config .set ("sm.vacuum.timestamp_start" , "0" );
101
+ config .set ("sm.vacuum.timestamp_end" , "20" );
102
+ ctx = new Context (config );
103
+ // create array
104
+ arrayCreate ();
105
+ // updates
106
+ arrayWrite1 ();
107
+ arrayWrite2 ();
108
+ arrayWrite3 ();
109
+ // consolidate
110
+ Array .consolidate (ctx , arrayURI );
111
+ Array .vacuum (ctx , arrayURI );
112
+ // verify consolidation
113
+ arrayRead ();
114
+
115
+ // verify vacuum
116
+ File f = new File (arrayURI );
117
+ int nFiles = 0 ;
118
+ for (File file : f .listFiles ())
119
+ if (file .isDirectory ()
120
+ && !file .getName ().equals ("__meta" )
121
+ && !file .getName ().equals ("__schema" )) {
122
+ nFiles ++;
123
+ }
124
+
125
+ Assert .assertEquals (2 , nFiles );
126
+ }
127
+
79
128
public void arrayCreate () throws Exception {
80
129
81
130
// Create getDimensions
@@ -108,7 +157,7 @@ public void arrayWrite1() throws Exception {
108
157
NativeArray subarray = new NativeArray (ctx , new int [] {1 , 2 , 1 , 4 }, Integer .class );
109
158
110
159
// Create query
111
- Array array = new Array (ctx , arrayURI , TILEDB_WRITE );
160
+ Array array = new Array (ctx , arrayURI , TILEDB_WRITE , BigInteger . valueOf ( 10L ) );
112
161
Query query = new Query (array );
113
162
query .setLayout (TILEDB_ROW_MAJOR );
114
163
query .setBuffer ("a" , data );
@@ -126,7 +175,7 @@ public void arrayWrite2() throws Exception {
126
175
NativeArray subarray = new NativeArray (ctx , new int [] {2 , 3 , 2 , 3 }, Integer .class );
127
176
128
177
// Create query
129
- Array array = new Array (ctx , arrayURI , TILEDB_WRITE );
178
+ Array array = new Array (ctx , arrayURI , TILEDB_WRITE , BigInteger . valueOf ( 20L ) );
130
179
Query query = new Query (array );
131
180
query .setLayout (TILEDB_ROW_MAJOR );
132
181
query .setBuffer ("a" , data );
@@ -152,7 +201,7 @@ public void arrayWrite3() throws Exception {
152
201
NativeArray coords = new NativeArray (ctx , new int [] {1 , 1 , 3 , 4 }, Integer .class );
153
202
154
203
// Create query
155
- Array array = new Array (ctx , arrayURI , TILEDB_WRITE );
204
+ Array array = new Array (ctx , arrayURI , TILEDB_WRITE , BigInteger . valueOf ( 30L ) );
156
205
Query query = new Query (array );
157
206
query .setLayout (TILEDB_ROW_MAJOR );
158
207
query .setBuffer ("a" , data );
0 commit comments