Skip to content

Commit a40f167

Browse files
Alex MellnikAlex Mellnik
authored andcommitted
Add test for removeduplicates! using the new format
1 parent 5c7ba29 commit a40f167

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/runtests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,24 @@ dt2 = SQLite.query(db, "Select * from temp")
290290
#There might be a better way to check this
291291
@test dt.data[1][1].value==dt2.data[1][1].value
292292
@test dt.data[1][2].isnull==dt2.data[1][2].isnull
293+
294+
#Test removeduplicates!
295+
db = SQLite.DB() #In case the order of tests is changed
296+
ints = Int64[1,1,2,2,3]
297+
strs = UTF8String["A", "A", "B", "C", "C"]
298+
nvInts = NullableArrays.NullableArray(ints)
299+
nvStrs = NullableArrays.NullableArray(strs)
300+
schema = DataStreams.Data.Schema(["ints", "strs"], [Int64, UTF8String],5)
301+
d = NullableArrays.NullableVector[nvInts, nvStrs]
302+
dt = DataStreams.Data.Table(schema, d,0)
303+
SQLite.drop!(db, "temp", ifexists=true)
304+
sink = SQLite.Sink(dt, db, "temp")
305+
Data.stream!(dt, sink)
306+
SQLite.removeduplicates!(db, "temp", ["ints","strs"]) #New format
307+
dt3 = SQLite.query(db, "Select * from temp")
308+
@test get(dt3[1,1]) == 1
309+
@test get(dt3[1,2]) == "A"
310+
@test get(dt3[2,1]) == 2
311+
@test get(dt3[2,2]) == "B"
312+
@test get(dt3[3,1]) == 2
313+
@test get(dt3[3,2]) == "C"

0 commit comments

Comments
 (0)