-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathjoin.jl
3073 lines (2613 loc) · 250 KB
/
join.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using Test, InMemoryDatasets, Random, CategoricalArrays, PooledArrays
const ≅ = isequal
DATE(x) = Date(x)
DATE(::Missing) = missing
isequal_coltyped(ds1::AbstractDataset, ds2::AbstractDataset) =
isequal(ds1, ds2) && typeof.(eachcol(ds1)) == typeof.(eachcol(ds2))
name = Dataset(ID = Union{Int, Missing}[1, 2, 3],
Name = Union{String, Missing}["John Doe", "Jane Doe", "Joe Blogs"])
job = Dataset(ID = Union{Int, Missing}[1, 2, 2, 4],
Job = Union{String, Missing}["Lawyer", "Doctor", "Florist", "Farmer"])
# Test output of various join types
outer = Dataset(ID = [1, 2, 2, 3, 4],
Name = ["John Doe", "Jane Doe", "Jane Doe", "Joe Blogs", missing],
Job = ["Lawyer", "Doctor", "Florist", missing, "Farmer"])
# (Tests use current column ordering but don't promote it)
right = outer[Bool[!ismissing(x) for x in outer.Job], [:ID, :Name, :Job]]
left = outer[Bool[!ismissing(x) for x in outer.Name], :]
inner = left[Bool[!ismissing(x) for x in left.Job], :]
semi = unique(inner[:, [:ID, :Name]])
anti = left[Bool[ismissing(x) for x in left.Job], [:ID, :Name]]
classA = Dataset(id = ["id1", "id2", "id3", "id4", "id5"],
mark = [50, 69.5, 45.5, 88.0, 98.5])
grades = Dataset(mark = [0, 49.5, 59.5, 69.5, 79.5, 89.5, 95.5],
grade = ["F", "P", "C", "B", "A-", "A", "A+"])
closeone = Dataset(id = ["id1", "id2", "id3", "id4", "id5"],
mark = [50, 69.5, 45.5, 88.0, 98.5],
grade = ["P", "B", "F", "A-", "A+"])
trades = Dataset(
[["20160525 13:30:00.023",
"20160525 13:30:00.038",
"20160525 13:30:00.048",
"20160525 13:30:00.048",
"20160525 13:30:00.048"],
["MSFT", "MSFT",
"GOOG", "GOOG", "AAPL"],
[51.95, 51.95,
720.77, 720.92, 98.00],
[75, 155,
100, 100, 100]],
["time", "ticker", "price", "quantity"]);
modify!(trades, 1 => byrow(x -> DateTime(x, dateformat"yyyymmdd HH:MM:SS.s")));
quotes = Dataset(
[["20160525 13:30:00.023",
"20160525 13:30:00.023",
"20160525 13:30:00.030",
"20160525 13:30:00.041",
"20160525 13:30:00.048",
"20160525 13:30:00.049",
"20160525 13:30:00.072",
"20160525 13:30:00.075"],
["GOOG", "MSFT", "MSFT", "MSFT",
"GOOG", "AAPL", "GOOG", "MSFT"],
[720.50, 51.95, 51.97, 51.99,
720.50, 97.99, 720.50, 52.01],
[720.93, 51.96, 51.98, 52.00,
720.93, 98.01, 720.88, 52.03]],
["time", "ticker", "bid", "ask"]);
modify!(quotes, 1 => byrow(x -> DateTime(x, dateformat"yyyymmdd HH:MM:SS.s")));
closefinance1 = Dataset([Union{Missing, DateTime}[DateTime("2016-05-25T13:30:00.023"), DateTime("2016-05-25T13:30:00.038"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048")],
Union{Missing, String}["MSFT", "MSFT", "GOOG", "GOOG", "AAPL"],
Union{Missing, Float64}[51.95, 51.95, 720.77, 720.92, 98.0],
Union{Missing, Int64}[75, 155, 100, 100, 100],
Union{Missing, String}["MSFT", "MSFT", "GOOG", "GOOG", "GOOG"],
Union{Missing, Float64}[51.95, 51.97, 720.5, 720.5, 720.5],
Union{Missing, Float64}[51.96, 51.98, 720.93, 720.93, 720.93]],["time", "ticker", "price", "quantity", "ticker_1", "bid", "ask"])
closfinance_tol2ms = Dataset([Union{Missing, DateTime}[DateTime("2016-05-25T13:30:00.023"), DateTime("2016-05-25T13:30:00.038"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048")], Union{Missing, String}["MSFT", "MSFT", "GOOG", "GOOG", "AAPL"], Union{Missing, Float64}[51.95, 51.95, 720.77, 720.92, 98.0], Union{Missing, Int64}[75, 155, 100, 100, 100], Union{Missing, Float64}[51.95, missing, 720.5, 720.5, missing], Union{Missing, Float64}[51.96, missing, 720.93, 720.93, missing]], ["time", "ticker", "price", "quantity", "bid", "ask"])
closfinance_tol0ms = Dataset([Union{Missing, DateTime}[DateTime("2016-05-25T13:30:00.023"), DateTime("2016-05-25T13:30:00.038"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048")], Union{Missing, String}["MSFT", "MSFT", "GOOG", "GOOG", "AAPL"], Union{Missing, Float64}[51.95, 51.95, 720.77, 720.92, 98.0], Union{Missing, Int64}[75, 155, 100, 100, 100], Union{Missing, Float64}[missing, missing, missing, missing, missing], Union{Missing, Float64}[missing, missing, missing, missing, missing]], ["time", "ticker", "price", "quantity", "bid", "ask"])
closefinance_tol10ms_noexact = Dataset([Union{Missing, DateTime}[DateTime("2016-05-25T13:30:00.023"), DateTime("2016-05-25T13:30:00.038"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048"), DateTime("2016-05-25T13:30:00.048")], Union{Missing, String}["MSFT", "MSFT", "GOOG", "GOOG", "AAPL"], Union{Missing, Float64}[51.95, 51.95, 720.77, 720.92, 98.0], Union{Missing, Int64}[75, 155, 100, 100, 100], Union{Missing, Float64}[missing, 51.97, missing, missing, missing], Union{Missing, Float64}[missing, 51.98, missing, missing, missing]], ["time", "ticker", "price", "quantity", "bid", "ask"])
@testset "general usage" begin
# Join on symbols or vectors of symbols
innerjoin(name, job, on = :ID)
innerjoin(name, job, on = [:ID])
@test_throws ArgumentError innerjoin(name, job)
@test_throws MethodError innerjoin(name, job, on = :ID, matchmissing=:errors)
@test_throws MethodError outerjoin(name, job, on = :ID, matchmissing=:notequal)
@test innerjoin(name, job, on = :ID) == inner == innerjoin(name, job, on = :ID, method = :hash)
@test outerjoin(name, job, on = :ID) == outer == outerjoin(name, job, on = :ID, method = :hash)
@test leftjoin(name, job, on = :ID) == left == leftjoin(name, job, on = :ID, method = :hash)
@test semijoin(name, job, on = :ID) == semi == semijoin(name, job, on = :ID, method = :hash)
@test antijoin(name, job, on = :ID) == anti == antijoin(name, job, on = :ID, method = :hash)
@test closejoin(classA, grades, on = :mark) == closeone == closejoin(classA, grades, on = :mark, method = :hash)
@test closejoin(trades, quotes, on = :time, makeunique = true) == closefinance1 == closejoin(trades, quotes, on = :time, makeunique = true, method = :hash)
@test innerjoin(name, job, on = :ID) == inner == innerjoin(name, job, on = :ID, threads = false)
@test innerjoin(name, job, on = :ID) == inner == innerjoin(name, job, on = :ID, method = :hash, threads = false)
@test outerjoin(name, job, on = :ID) == outer == outerjoin(name, job, on = :ID, threads = false)
@test outerjoin(name, job, on = :ID) == outer == outerjoin(name, job, on = :ID, method = :hash, threads = false)
@test leftjoin(name, job, on = :ID) == left == leftjoin(name, job, on = :ID, threads = false)
@test leftjoin(name, job, on = :ID) == left == leftjoin(name, job, on = :ID, method = :hash, threads = false)
@test semijoin(name, job, on = :ID) == semi == semijoin(name, job, on = :ID, threads = false)
@test semijoin(name, job, on = :ID) == semi == semijoin(name, job, on = :ID, method = :hash, threads = false)
@test antijoin(name, job, on = :ID) == anti == antijoin(name, job, on = :ID, threads = false)
@test antijoin(name, job, on = :ID) == anti == antijoin(name, job, on = :ID, method = :hash, threads = false)
@test closejoin(classA, grades, on = :mark) == closeone == closejoin(classA, grades, on = :mark, threads = false)
@test closejoin(classA, grades, on = :mark) == closeone == closejoin(classA, grades, on = :mark, method = :hash, threads = false)
@test closejoin(trades, quotes, on = :time, makeunique = true) == closefinance1 == closejoin(trades, quotes, on = :time, makeunique = true, threads = false)
@test closejoin(trades, quotes, on = :time, makeunique = true) == closefinance1 == closejoin(trades, quotes, on = :time, makeunique = true, method = :hash, threads = false)
@test innerjoin(name, view(job, :, :), on = :ID) == inner
@test outerjoin(name, view(job, :, :), on = :ID) == outer
@test leftjoin(name, view(job, :, :), on = :ID) == left
@test semijoin(name, view(job, :, :), on = :ID) == semi
@test antijoin(name, view(job, :, :), on = :ID) == anti
@test closejoin(classA, view(grades, :, :), on = :mark) == closeone
@test closejoin(trades, view(quotes, :, :), on = :time, makeunique = true) == closefinance1
@test innerjoin(name, view(job, :, :), on = :ID, method = :hash) == inner
@test outerjoin(name, view(job, :, :), on = :ID, method = :hash) == outer
@test leftjoin(name, view(job, :, :), on = :ID, method = :hash) == left
@test semijoin(name, view(job, :, :), on = :ID, method = :hash) == semi
@test antijoin(name, view(job, :, :), on = :ID, method = :hash) == anti
@test closejoin(classA, view(grades, :, :), on = :mark, method = :hash) == closeone
@test closejoin(trades, view(quotes, :, :), on = :time, makeunique = true, method = :hash) == closefinance1
@test innerjoin(name, view(job, :, :), on = :ID, threads = false) == inner
@test innerjoin(name, view(job, :, :), on = :ID, method = :hash, threads = false) == inner
@test outerjoin(name, view(job, :, :), on = :ID, threads = false) == outer
@test outerjoin(name, view(job, :, :), on = :ID, method = :hash, threads = false) == outer
@test leftjoin(name, view(job, :, :), on = :ID, threads = false) == left
@test leftjoin(name, view(job, :, :), on = :ID, method = :hash, threads = false) == left
@test semijoin(name, view(job, :, :), on = :ID, threads = false) == semi
@test semijoin(name, view(job, :, :), on = :ID, method = :hash, threads = false) == semi
@test antijoin(name, view(job, :, :), on = :ID, threads = false) == anti
@test antijoin(name, view(job, :, :), on = :ID, method = :hash, threads = false) == anti
@test closejoin(classA, view(grades, :, :), on = :mark, threads = false) == closeone
@test closejoin(classA, view(grades, :, :), on = :mark, method = :hash, threads = false) == closeone
@test closejoin(trades, view(quotes, :, :), on = :time, makeunique = true, threads = false) == closefinance1
@test closejoin(trades, view(quotes, :, :), on = :time, makeunique = true, method = :hash, threads = false) == closefinance1
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(2)) == closfinance_tol2ms
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Day(2)) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(0)) == closfinance_tol0ms
@test closejoin(trades, quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(2)) == closfinance_tol2ms
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Day(2)) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(0)) == closfinance_tol0ms
@test closejoin!(copy(trades), quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false) == closefinance_tol10ms_noexact
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(2), method = :hash) == closfinance_tol2ms
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Day(2), method = :hash) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(0), method = :hash) == closfinance_tol0ms
@test closejoin(trades, quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(2), method = :hash) == closfinance_tol2ms
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Day(2), method = :hash) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(0), method = :hash) == closfinance_tol0ms
@test closejoin!(copy(trades), quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash) == closefinance_tol10ms_noexact
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(2),threads = false) == closfinance_tol2ms
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(2),method = :hash, threads = false) == closfinance_tol2ms
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Day(2),threads = false) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Day(2),method = :hash, threads = false) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(0),threads = false) == closfinance_tol0ms
@test closejoin(trades, quotes, on =[:ticker, :time], tol = Millisecond(0),method = :hash, threads = false) == closfinance_tol0ms
@test closejoin(trades, quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false,threads = false) == closefinance_tol10ms_noexact
@test closejoin(trades, quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false,method = :hash, threads = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(2),threads = false) == closfinance_tol2ms
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(2),method = :hash, threads = false) == closfinance_tol2ms
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Day(2),threads = false) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Day(2),method = :hash, threads = false) == closejoin(trades, quotes, on =[:ticker, :time])
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(0),threads = false) == closfinance_tol0ms
@test closejoin!(copy(trades), quotes, on =[:ticker, :time], tol = Millisecond(0),method = :hash, threads = false) == closfinance_tol0ms
@test closejoin!(copy(trades), quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false,threads = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), quotes, on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false,method = :hash, threads = false) == closefinance_tol10ms_noexact
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2)) == closfinance_tol2ms
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Day(2)) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0)) == closfinance_tol0ms
@test closejoin(trades, view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2)) == closfinance_tol2ms
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Day(2)) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0)) == closfinance_tol0ms
@test closejoin!(copy(trades), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false) == closefinance_tol10ms_noexact
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash) == closfinance_tol2ms
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash) == closfinance_tol0ms
@test closejoin(trades, view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash) == closfinance_tol2ms
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash) == closfinance_tol0ms
@test closejoin!(copy(trades), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash) == closefinance_tol10ms_noexact
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), threads = false) == closfinance_tol2ms
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash, threads = false) == closfinance_tol2ms
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Day(2), threads = false) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash, threads = false) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), threads = false) == closfinance_tol0ms
@test closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash, threads = false) == closfinance_tol0ms
@test closejoin(trades, view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, threads = false) == closefinance_tol10ms_noexact
@test closejoin(trades, view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash, threads = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), threads = false) == closfinance_tol2ms
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash, threads = false) == closfinance_tol2ms
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), threads = false) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash, threads = false) == closejoin(trades, view(quotes, :, :), on =[:ticker, :time])
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), threads = false) == closfinance_tol0ms
@test closejoin!(copy(trades), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash, threads = false) == closfinance_tol0ms
@test closejoin!(copy(trades), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, threads = false) == closefinance_tol10ms_noexact
@test closejoin!(copy(trades), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash, threads = false) == closefinance_tol10ms_noexact
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :sort) == closfinance_tol2ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :sort) == closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time])
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :sort) == closfinance_tol0ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :sort) == closefinance_tol10ms_noexact
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash) == closfinance_tol2ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash) == closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time])
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash) == closfinance_tol0ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash) == closefinance_tol10ms_noexact
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), threads = false) == closfinance_tol2ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash, threads = false) == closfinance_tol2ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), threads = false) == closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time])
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Day(2), method = :hash, threads = false) == closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time])
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), threads = false) == closfinance_tol0ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(0), method = :hash, threads = false) == closfinance_tol0ms
@test closejoin(view(trades, :, :), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, threads = false) == closefinance_tol10ms_noexact
@test closejoin(view(trades, :, :), view(quotes, :, :), on = [:ticker, :time], tol = Millisecond(10), allow_exact_match = false, method = :hash, threads = false) == closefinance_tol10ms_noexact
ANS = closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2))
@test ANS.price.val !== trades.price.val
cpy_trades = copy(trades)
closejoin!(cpy_trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2))
@test ANS.price.val !== trades.price.val
ANS = closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash)
ANS = closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), threads = false)
ANS = closejoin(trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash, threads = false)
@test ANS.price.val !== trades.price.val
cpy_trades = copy(trades)
closejoin!(cpy_trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash)
cpy_trades = copy(trades)
closejoin!(cpy_trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), threads = false)
cpy_trades = copy(trades)
closejoin!(cpy_trades, view(quotes, :, :), on =[:ticker, :time], tol = Millisecond(2), method = :hash, threads = false)
@test ANS.price.val !== trades.price.val
# Join with no non-key columns
on = [:ID]
nameid = name[:, on]
jobid = job[:, on]
@test innerjoin(nameid, jobid, on = :ID) == inner[:, on]
@test outerjoin(nameid, jobid, on = :ID) == outer[:, on]
@test leftjoin(nameid, jobid, on = :ID) == left[:, on]
@test semijoin(nameid, jobid, on = :ID) == semi[:, on]
@test antijoin(nameid, jobid, on = :ID) == anti[:, on]
@test innerjoin(nameid, view(jobid, :, :), on = :ID) == inner[:, on]
@test outerjoin(nameid, view(jobid, :, :), on = :ID) == outer[:, on]
@test leftjoin(nameid, view(jobid, :, :), on = :ID) == left[:, on]
@test innerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID) == inner[:, on]
@test outerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID) == outer[:, on]
@test leftjoin(view(nameid, :, :), view(jobid, :, :), on = :ID) == left[:, on]
@test semijoin(nameid, view(jobid, :, :), on = :ID) == semi[:, on]
@test antijoin(nameid, view(jobid, :, :), on = :ID) == anti[:, on]
@test innerjoin(nameid, jobid, on = :ID, method = :hash) == inner[:, on]
@test outerjoin(nameid, jobid, on = :ID, method = :hash) == outer[:, on]
@test leftjoin(nameid, jobid, on = :ID, method = :hash) == left[:, on]
@test semijoin(nameid, jobid, on = :ID, method = :hash) == semi[:, on]
@test antijoin(nameid, jobid, on = :ID, method = :hash) == anti[:, on]
@test innerjoin(nameid, view(jobid, :, :), on = :ID, method = :hash) == inner[:, on]
@test outerjoin(nameid, view(jobid, :, :), on = :ID, method = :hash) == outer[:, on]
@test leftjoin(nameid, view(jobid, :, :), on = :ID, method = :hash) == left[:, on]
@test innerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash) == inner[:, on]
@test outerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash) == outer[:, on]
@test leftjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash) == left[:, on]
@test semijoin(nameid, view(jobid, :, :), on = :ID, method = :hash) == semi[:, on]
@test antijoin(nameid, view(jobid, :, :), on = :ID, method = :hash) == anti[:, on]
@test innerjoin(nameid, jobid, on = :ID, threads = false) == inner[:, on]
@test innerjoin(nameid, jobid, on = :ID, method = :hash, threads = false) == inner[:, on]
@test outerjoin(nameid, jobid, on = :ID, threads = false) == outer[:, on]
@test outerjoin(nameid, jobid, on = :ID, method = :hash, threads = false) == outer[:, on]
@test leftjoin(nameid, jobid, on = :ID, threads = false) == left[:, on]
@test leftjoin(nameid, jobid, on = :ID, method = :hash, threads = false) == left[:, on]
@test semijoin(nameid, jobid, on = :ID, threads = false) == semi[:, on]
@test semijoin(nameid, jobid, on = :ID, method = :hash, threads = false) == semi[:, on]
@test antijoin(nameid, jobid, on = :ID, threads = false) == anti[:, on]
@test antijoin(nameid, jobid, on = :ID, method = :hash, threads = false) == anti[:, on]
@test innerjoin(nameid, view(jobid, :, :), on = :ID, threads = false) == inner[:, on]
@test innerjoin(nameid, view(jobid, :, :), on = :ID, method = :hash, threads = false) == inner[:, on]
@test outerjoin(nameid, view(jobid, :, :), on = :ID, threads = false) == outer[:, on]
@test outerjoin(nameid, view(jobid, :, :), on = :ID, method = :hash, threads = false) == outer[:, on]
@test leftjoin(nameid, view(jobid, :, :), on = :ID, threads = false) == left[:, on]
@test leftjoin(nameid, view(jobid, :, :), on = :ID, method = :hash, threads = false) == left[:, on]
@test innerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, threads = false) == inner[:, on]
@test innerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash, threads = false) == inner[:, on]
@test outerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, threads = false) == outer[:, on]
@test outerjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash, threads = false) == outer[:, on]
@test leftjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, threads = false) == left[:, on]
@test leftjoin(view(nameid, :, :), view(jobid, :, :), on = :ID, method = :hash, threads = false) == left[:, on]
@test semijoin(nameid, view(jobid, :, :), on = :ID, threads = false) == semi[:, on]
@test semijoin(nameid, view(jobid, :, :), on = :ID, method = :hash, threads = false) == semi[:, on]
@test antijoin(nameid, view(jobid, :, :), on = :ID, threads = false) == anti[:, on]
@test antijoin(nameid, view(jobid, :, :), on = :ID, method = :hash, threads = false) == anti[:, on]
# Join on multiple keys
ds1 = Dataset(A = 1, B = 2, C = 3)
ds2 = Dataset(A = 1, B = 2, D = 4)
@test innerjoin(ds1, ds2, on = [:A, :B]) == Dataset(A = 1, B = 2, C = 3, D = 4)
@test innerjoin(ds1, view(ds2, :, :), on = [:A, :B]) == Dataset(A = 1, B = 2, C = 3, D = 4)
@test innerjoin(ds1, ds2, on = [:A, :B], method = :hash) == Dataset(A = 1, B = 2, C = 3, D = 4)
@test innerjoin(ds1, view(ds2, :, :), on = [:A, :B], method = :hash) == Dataset(A = 1, B = 2, C = 3, D = 4)
@test innerjoin(ds1, view(ds2, :, :), on = [:A, :B], threads = false) == Dataset(A = 1, B = 2, C = 3, D = 4)
@test innerjoin(ds1, view(ds2, :, :), on = [:A, :B], method = :hash, threads = false) == Dataset(A = 1, B = 2, C = 3, D = 4)
dsl = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]], ["x1", "x2", "x3", "row"])
dsr = Dataset(x1=[1, 3], y =[100.0, 200.0])
setformat!(dsl, 1=>iseven)
setformat!(dsr, 1=>isodd)
left1 = leftjoin(dsl, dsr, on = :x1)
left1_v = leftjoin(dsl, view(dsr, :, [2,1]), on = :x1)
left1_t = Dataset([Union{Missing, Int64}[10, 10, 3, 4, 4, 1, 5, 5, 6, 6, 7, 2, 2, 10, 10],
Union{Missing, Int64}[10, 10, 3, 4, 4, 1, 5, 5, 6, 6, 7, 2, 2, 10, 10],
Union{Missing, Int64}[3, 3, 6, 7, 7, 10, 10, 5, 10, 10, 9, 1, 1, 1, 1],
Union{Missing, Int64}[1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 10],
Union{Missing, Float64}[100.0, 200.0, missing, 100.0, 200.0, missing, missing, missing, 100.0, 200.0, missing, 100.0, 200.0, 100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
left2 = leftjoin(dsl, dsr, on = :x1, mapformats = [true, false])
left2_v = leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false])
@test left2 == leftjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash)
@test left2_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash)
@test left2 == leftjoin(dsl, dsr, on = :x1, mapformats = [true, false], threads = false)
@test left2 == leftjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash, threads = false)
@test left2_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], threads = false)
@test left2_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash, threads = false)
left2_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[100.0, missing, 100.0, missing, missing, missing, 100.0, missing, 100.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
left3 = leftjoin(dsl, dsr, on = :x1, mapformats = [false, true])
left3_v = leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true])
@test left3 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash)
@test left3_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash)
@test left3 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, true], threads = false)
@test left3 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash, threads = false)
@test left3_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], threads = false)
@test left3_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash, threads = false)
left3_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, missing, missing, 100.0, 200.0, missing, missing, missing, missing, missing, missing]], ["x1", "x2", "x3", "row", "y"])
left4 = leftjoin(dsl, dsr, on = :x1, mapformats = [false, false])
left4_v = leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false])
@test left4 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash)
@test left4_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash)
@test left4 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, false], threads = false)
@test left4 == leftjoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash, threads = false)
@test left4_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], threads = false)
@test left4_v == leftjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash, threads = false)
left4_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, 200.0, missing, 100.0, missing, missing, missing, missing, missing, missing]], ["x1", "x2", "x3", "row", "y"])
inner1 = innerjoin(dsl, dsr, on = :x1)
inner1_v = innerjoin(dsl, view(dsr, :, [2,1]), on = :x1)
@test inner1 == innerjoin(dsl, dsr, on = :x1, method = :hash)
@test inner1_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash)
@test inner1 == innerjoin(dsl, dsr, on = :x1, threads = false)
@test inner1 == innerjoin(dsl, dsr, on = :x1, method = :hash, threads = false)
@test inner1_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, threads = false)
@test inner1_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash, threads = false)
inner1_t = Dataset([Union{Missing, Int64}[10, 10, 4, 4, 6, 6, 2, 2, 10, 10],
Union{Missing, Int64}[10, 10, 4, 4, 6, 6, 2, 2, 10, 10],
Union{Missing, Int64}[3, 3, 7, 7, 10, 10, 1, 1, 1, 1],
Union{Missing, Int64}[1, 1, 3, 3, 7, 7, 9, 9, 10, 10],
Union{Missing, Float64}[100.0, 200.0, 100.0, 200.0, 100.0, 200.0, 100.0, 200.0, 100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
inner2 = innerjoin(dsl, dsr, on = :x1, mapformats = [true, false])
inner2_v = innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false])
@test inner2 == innerjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash)
@test inner2_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash)
@test inner2 == innerjoin(dsl, dsr, on = :x1, mapformats = [true, false], threads = false)
@test inner2 == innerjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash, threads = false)
@test inner2_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], threads = false)
@test inner2_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash, threads = false)
inner2_t = Dataset([ Union{Missing, Int64}[10, 4, 6, 2, 10],
Union{Missing, Int64}[10, 4, 6, 2, 10],
Union{Missing, Int64}[3, 7, 10, 1, 1],
Union{Missing, Int64}[1, 3, 7, 9, 10],
Union{Missing, Float64}[100.0, 100.0, 100.0, 100.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
inner3 = innerjoin(dsl, dsr, on = :x1, mapformats = [false, true])
inner3_v = innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true])
@test inner3 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash)
@test inner3_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash)
@test inner3 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, true], threads = false)
@test inner3 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash, threads = false)
@test inner3_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], threads = false)
@test inner3_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash, threads = false)
inner3_t = Dataset([Union{Missing, Int64}[1, 1],
Union{Missing, Int64}[1, 1],
Union{Missing, Int64}[10, 10],
Union{Missing, Int64}[4, 4],
Union{Missing, Float64}[100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
inner4 = innerjoin(dsl, dsr, on = :x1, mapformats = [false, false])
inner4_v = innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false])
@test inner4 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash)
@test inner4_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash)
@test inner4 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, false], threads = false)
@test inner4 == innerjoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash, threads = false)
@test inner4_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], threads = false)
@test inner4_v == innerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash, threads = false)
inner4_t = Dataset([Union{Missing, Int64}[3, 1],
Union{Missing, Int64}[3, 1],
Union{Missing, Int64}[6, 10],
Union{Missing, Int64}[2, 4],
Union{Missing, Float64}[200.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
outer1 = outerjoin(dsl, dsr, on = :x1)
outer1_v = outerjoin(dsl, view(dsr, :, [2,1]), on = :x1)
@test outer1 == outerjoin(dsl, dsr, on = :x1, method = :hash)
@test outer1_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash)
@test outer1 == outerjoin(dsl, dsr, on = :x1, threads = false)
@test outer1 == outerjoin(dsl, dsr, on = :x1, method = :hash, threads = false)
@test outer1_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, threads = false)
@test outer1_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash, threads = false)
outer1_t = Dataset([Union{Missing, Int64}[10, 10, 3, 4, 4, 1, 5, 5, 6, 6, 7, 2, 2, 10, 10],
Union{Missing, Int64}[10, 10, 3, 4, 4, 1, 5, 5, 6, 6, 7, 2, 2, 10, 10],
Union{Missing, Int64}[3, 3, 6, 7, 7, 10, 10, 5, 10, 10, 9, 1, 1, 1, 1],
Union{Missing, Int64}[1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10, 10],
Union{Missing, Float64}[100.0, 200.0, missing, 100.0, 200.0, missing, missing, missing, 100.0, 200.0, missing, 100.0, 200.0, 100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
outer2 = outerjoin(dsl, dsr, on = :x1, mapformats = [false, true])
outer2_v = outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true])
@test outer2 == outerjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash)
@test outer2_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash)
@test outer2 == outerjoin(dsl, dsr, on = :x1, mapformats = [false, true], threads = false)
@test outer2 == outerjoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash, threads = false)
@test outer2_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], threads = false)
@test outer2_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash, threads = false)
outer2_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, missing, missing, 100.0, 200.0, missing, missing, missing, missing, missing, missing]], ["x1", "x2", "x3", "row", "y"])
outer3 = outerjoin(dsl, dsr, on = :x1, mapformats = [true, false])
outer3_v = outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false])
@test outer3 == outerjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash)
@test outer3_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash)
@test outer3 == outerjoin(dsl, dsr, on = :x1, mapformats = [true, false], threads = false)
@test outer3 == outerjoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash, threads = false)
@test outer3_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], threads = false)
@test outer3_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash, threads = false)
outer3_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10, 3],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10, missing],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1, missing],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, missing],
Union{Missing, Float64}[100.0, missing, 100.0, missing, missing, missing, 100.0, missing, 100.0, 100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
outer4 = outerjoin(dsl, dsr, on = :x1, mapformats = [false, false])
outer4_v = outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false])
@test outer4 == outerjoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash)
@test outer4_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash)
@test outer4 == outerjoin(dsl, dsr, on = :x1, mapformats = [false, false], threads =false)
@test outer4_v == outerjoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], threads =false)
outer4_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, 200.0, missing, 100.0, missing, missing, missing, missing, missing, missing]], ["x1", "x2", "x3", "row", "y"])
contains1 = contains(dsl, dsr, on = :x1)
contains1_v = contains(dsl, view(dsr, :, [2,1]), on = :x1)
@test contains1 == contains(dsl, dsr, on = :x1, method = :hash)
@test contains1_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash)
@test contains1 == contains(dsl, dsr, on = :x1, threads = false)
@test contains1 == contains(dsl, dsr, on = :x1, method = :hash, threads = false)
@test contains1_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, threads = false)
@test contains1_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash, threads = false)
contains1_t = Bool[1, 0, 1, 0, 0, 0, 1, 0, 1, 1]
contains2 = contains(dsl, dsr, on = :x1, mapformats = [true, false])
contains2_v = contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false])
@test contains2 == contains(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash)
@test contains2_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash)
@test contains2 == contains(dsl, dsr, on = :x1, mapformats = [true, false], threads = false)
@test contains2 == contains(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash, threads = false)
@test contains2_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], threads = false)
@test contains2_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash, threads = false)
contains2_t = Bool[1, 0, 1, 0, 0, 0, 1, 0, 1, 1]
contains3 = contains(dsl, dsr, on = :x1, mapformats =[false, true])
contains3_v = contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats =[false, true])
@test contains3 == contains(dsl, dsr, on = :x1, mapformats =[false, true], method = :hash)
@test contains3_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats =[false, true], method = :hash)
@test contains3 == contains(dsl, dsr, on = :x1, mapformats =[false, true], threads = false)
@test contains3 == contains(dsl, dsr, on = :x1, mapformats =[false, true], method = :hash, threads = false)
@test contains3_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats =[false, true], threads = false)
@test contains3_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats =[false, true], method = :hash, threads = false)
contains3_t = Bool[0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
contains4 = contains(dsl, dsr, on = :x1, mapformats = [false, false])
contains4_v = contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false])
@test contains4 == contains(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash)
@test contains4_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash)
@test contains4 == contains(dsl, dsr, on = :x1, mapformats = [false, false], threads = false)
@test contains4 == contains(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash, threads = false)
@test contains4_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], threads = false)
@test contains4_v == contains(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash, threads = false)
contains4_t = Bool[0, 1, 0, 1, 0, 0, 0, 0, 0, 0]
close1 = closejoin(dsl, dsr, on = :x1)
close1_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1)
@test close1 == closejoin(dsl, dsr, on = :x1, method = :hash)
@test close1_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, method = :hash)
@test close1 == closejoin(dsl, dsr, on = :x1, threads =false)
@test close1_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, threads =false)
close1_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, missing, 200.0, missing, missing, missing, 200.0, missing, 200.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
close2 = closejoin(dsl, dsr, on = :x1, direction = :forward)
close2_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, direction = :forward)
@test close2 == closejoin(dsl, dsr, on = :x1, direction = :forward, method = :hash)
@test close2_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, direction = :forward, method = :hash)
@test close2 == closejoin(dsl, dsr, on = :x1, direction = :forward, threads = false)
@test close2 == closejoin(dsl, dsr, on = :x1, direction = :forward, method = :hash, threads = false)
@test close2_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, direction = :forward, threads = false)
@test close2_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, direction = :forward, method = :hash, threads = false)
close2_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
close3 = closejoin(dsl, dsr, on = :x1, border = :nearest)
close3_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, border = :nearest)
@test close3 == closejoin(dsl, dsr, on = :x1, border = :nearest, method = :hash)
@test close3_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, border = :nearest, method = :hash)
@test close3 == closejoin(dsl, dsr, on = :x1, border = :nearest, threads = false)
@test close3 == closejoin(dsl, dsr, on = :x1, border = :nearest, method = :hash, threads = false)
@test close3_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, border = :nearest, threads = false)
@test close3_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, border = :nearest, method = :hash, threads = false)
close3_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, 100.0, 200.0, 100.0, 100.0, 100.0, 200.0, 100.0, 200.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
close4 = closejoin(dsl, dsr, on = :x1, mapformats = [true, false])
close4_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false])
@test close4 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash)
@test close4_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash)
@test close4 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], threads = false)
@test close4 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], method = :hash, threads = false)
@test close4_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], threads = false)
@test close4_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], method = :hash, threads = false)
close4_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[100.0, missing, 100.0, missing, missing, missing, 100.0, missing, 100.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
close5 = closejoin(dsl, dsr, on = :x1, mapformats = [true, false], direction = :forward)
close5_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], direction = :forward)
@test close5 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], direction = :forward, method = :hash)
@test close5_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], direction = :forward, method = :hash)
@test close5 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], direction = :forward, threads = false)
@test close5 == closejoin(dsl, dsr, on = :x1, mapformats = [true, false], direction = :forward, method = :hash, threads = false)
@test close5_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], direction = :forward, threads = false)
@test close5_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [true, false], direction = :forward, method = :hash, threads = false)
close5_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0]], ["x1", "x2", "x3", "row", "y"])
close6 = closejoin(dsl, dsr, on = :x1, mapformats = [false, true])
close6_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true])
@test close6 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash)
@test close6_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash)
@test close6 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], threads = false)
@test close6 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], method = :hash, threads = false)
@test close6_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], threads = false)
@test close6_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], method = :hash, threads = false)
close6_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
close7 = closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward)
close7_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward)
@test close7 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, method = :hash)
@test close7_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, method = :hash)
@test close7 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, threads = false)
@test close7 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, method = :hash, threads = false)
@test close7_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, threads = false)
@test close7_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, method = :hash, threads = false)
close7_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, missing, missing, 100.0, missing, missing, missing, missing, missing, missing]],["x1", "x2", "x3", "row", "y"])
close8 = closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, border = :nearest)
close8_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, border = :nearest)
@test close8 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, method = :hash)
@test close8_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, method = :hash)
@test close8 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, threads = false)
@test close8 == closejoin(dsl, dsr, on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, method = :hash, threads = false)
@test close8_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, threads = false)
@test close8_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, true], direction = :forward, border = :nearest, method = :hash, threads = false)
close8_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]],["x1", "x2", "x3", "row", "y"])
close9 = closejoin(dsl, dsr, on = :x1, mapformats = [false, false])
close9_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false])
@test close9 == closejoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash)
@test close9_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash)
@test close9 == closejoin(dsl, dsr, on = :x1, mapformats = [false, false], threads = false)
@test close9 == closejoin(dsl, dsr, on = :x1, mapformats = [false, false], method = :hash, threads = false)
@test close9_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], threads = false)
@test close9_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = [false, false], method = :hash, threads = false)
close9_t = Dataset([Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 200.0, 100.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
close10 = closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward)
close10_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward)
@test close10 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, method = :hash)
@test close10_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, method = :hash)
@test close10 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, threads = false)
@test close10 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, method = :hash, threads = false)
@test close10_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, threads = false)
@test close10_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, method = :hash, threads = false)
close10_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[missing, 200.0, missing, 100.0, missing, missing, missing, missing, 200.0, missing]], ["x1", "x2", "x3", "row", "y"])
close11 = closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, border = :nearest)
close11_v = closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, border = :nearest)
@test close11 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, border = :nearest, method = :hash)
@test close11_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, border = :nearest, method = :hash)
@test close11 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, border = :nearest, threads = false)
@test close11 == closejoin(dsl, dsr, on = :x1, mapformats = false, direction = :forward, border = :nearest, method = :hash, threads = false)
@test close11_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, border = :nearest, threads = false)
@test close11_v == closejoin(dsl, view(dsr, :, [2,1]), on = :x1, mapformats = false, direction = :forward, border = :nearest, method = :hash, threads = false)
close11_t = Dataset([ Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[10, 3, 4, 1, 5, 5, 6, 7, 2, 10],
Union{Missing, Int64}[3, 6, 7, 10, 10, 5, 10, 9, 1, 1],
Union{Missing, Int64}[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
Union{Missing, Float64}[200.0, 200.0, 200.0, 100.0, 200.0, 200.0, 200.0, 200.0, 200.0, 200.0]], ["x1", "x2", "x3", "row", "y"])
@test left1 == left1_t
@test left2 == left2_t
@test left3 == left3_t
@test left4 == left4_t
@test inner1 == inner1_t
@test inner2 == inner2_t
@test inner3 == inner3_t
@test inner4 == inner4_t
@test outer1 == outer1_t
@test outer2 == outer2_t
@test outer3 == outer3_t
@test outer4 == outer4_t
@test contains1 == contains1_t
@test contains2 == contains2_t
@test contains3 == contains3_t
@test contains4 == contains4_t
@test close1 == close1_t
@test close2 == close2_t
@test close3 == close3_t
@test close4 == close4_t
@test close5 == close5_t
@test close6 == close6_t
@test close7 == close7_t
@test close8 == close8_t
@test close9 == close9_t
@test close10 == close10_t
@test close11 == close11_t
@test left1_v == left1_t
@test left2_v == left2_t
@test left3_v == left3_t
@test left4_v == left4_t
@test inner1_v == inner1_t
@test inner2_v == inner2_t
@test inner3_v == inner3_t
@test inner4_v == inner4_t
@test outer1_v == outer1_t
@test outer2_v == outer2_t
@test outer3_v == outer3_t
@test outer4_v == outer4_t
@test contains1_v == contains1_t
@test contains2_v == contains2_t
@test contains3_v == contains3_t
@test contains4_v == contains4_t
@test close1_v == close1_t
@test close2_v == close2_t
@test close3_v == close3_t
@test close4_v == close4_t
@test close5_v == close5_t
@test close6_v == close6_t
@test close7_v == close7_t
@test close8_v == close8_t
@test close9_v == close9_t
@test close10_v == close10_t
@test close11_v == close11_t
dsl = Dataset([[Characters{1}(randstring(1)) for _ in 1:10^5] for _ in 1:3], :auto)
dsr = Dataset([[Characters{1}(randstring(1)) for _ in 1:10^5] for _ in 1:3], :auto)
left1 = leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false)
left2 = leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false)
@test left1 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false, method = :hash)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash)
@test left1 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false, threads = false)
@test left1 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false, method = :hash, threads = false)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, threads = false)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash, threads = false)
@test left1 == left2
@test unique(select!(left1, [:x1, :x2, :x3]), [:x1, :x2]) == unique(dsl, [:x1, :x2])
dsl = Dataset([[Characters{1}(randstring(1)) for _ in 1:10^5] for _ in 1:3], :auto)
dsr = Dataset([[Characters{1}(randstring(1)) for _ in 1:10^5] for _ in 1:3], :auto)
for i in 1:3
dsl[!, i] = PooledArray(dsl[!, i])
dsr[!, i] = PooledArray(dsr[!, i])
end
for i in 1:10
left1 = leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false)
left2 = leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, threads = false)
@test left2 == leftjoin(dsl, dsr, on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash, threads = false)
@test left1 == left2
@test unique(select!(left1, [:x1, :x2, :x3]), [:x1, :x2]) == unique(dsl, [:x1, :x2])
left1 = leftjoin(dsl, view(dsr, :, :), on = [:x1, :x2], makeunique = true, accelerate = true, stable =true, check = false)
left2 = leftjoin(dsl, view(dsr, :, :), on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false)
@test left2 == leftjoin(dsl, view(dsr, :, :), on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash)
@test left2 == leftjoin(dsl, view(dsr, :, :), on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, threads = false)
@test left2 == leftjoin(dsl, view(dsr, :, :), on = [:x1, :x2], makeunique = true, accelerate = false, stable = true, check = false, method = :hash, threads = false)
@test left1 == left2
@test unique(select!(left1, [:x1, :x2, :x3]), [:x1, :x2]) == unique(dsl, [:x1, :x2])
end
x1 = rand(1:1000, 5000)
x2 = rand(1:100, 5000)
y = rand(5000)
y2 = rand(5000)
dsl = Dataset(x1 = Characters{6}.(c"id" .* string.(x1)), x2 = Characters{5}.(c"id" .* string.(x2)), y = y)
dsr = Dataset(x1 = x1, x2 = x2, y2 = y2)
fmtfun(x) = @views parse(Int, x[3:end])
setformat!(dsl, 1:2=>fmtfun)
semi1 = semijoin(dsl, dsr, on = [:x1, :x2])
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], method = :hash)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], threads = false)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], method = :hash, threads = false)
semi2 = semijoin(dsl, dsr, on = [:x1, :x2], accelerate = true)
@test semi1 == dsl
@test semi2 == dsl
semi1 = semijoin(dsl, view(dsr, :, :), on = [:x1, :x2])
@test semi1 == semijoin(dsl, view(dsr, :, :), on = [:x1, :x2], method = :hash)
@test semi1 == semijoin(dsl, view(dsr, :, :), on = [:x1, :x2], threads = false)
@test semi1 == semijoin(dsl, view(dsr, :, :), on = [:x1, :x2], method = :hash, threads = false)
semi2 = semijoin(dsl, view(dsr, :, :), on = [:x1, :x2], accelerate = true)
@test semi1 == dsl
@test semi2 == dsl
inn1 = innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
out1 = outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
left1 = leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, method = :hash)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, threads = false)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, method = :hash, threads = false)
@test inn1 == out1 == left1
fmtfun2(x) = c"id" * Characters{4}(x)
setformat!(dsr, 1:2=>fmtfun2)
semi1 = semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true])
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true], method = :hash)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true], threads = false)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true], method = :hash, threads = false)
semi2 = semijoin(dsl, dsr, on = [:x1, :x2], accelerate = true, mapformats = [false, true])
@test semi1 == dsl
@test semi2 == dsl
inn1 = innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true)
out1 = outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true)
left1 = leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, method = :hash)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, threads = false)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, method = :hash, threads = false)
@test inn1 == out1 == left1
x1 = rand(1:1000, 5000)
x2 = rand(1:100, 5000)
y = rand(5000)
y2 = rand(5000)
dsl = Dataset(x1 = Characters{6}.(c"id" .* string.(x1)), x2 = Characters{5}.(c"id" .* string.(x2)), y = y)
dsr = Dataset(x1 = x1, x2 = x2, y2 = y2)
for i in 1:2
dsl[!, i] = PooledArray(dsl[!, i])
dsr[!, i] = PooledArray(dsr[!, i])
end
setformat!(dsl, 1:2=>fmtfun)
semi1 = semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false])
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false], method =:hash)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false], threads = false)
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false], method = :hash, threads = false)
semi2 = semijoin(dsl, dsr, on = [:x1, :x2], accelerate = true, mapformats = [true, false])
@test semi1 == dsl
@test semi2 == dsl
inn1 = innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
out1 = outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
left1 = leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, method = :hash)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, threads = false)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, method = :hash, threads = false)
@test inn1 == out1 == left1
setformat!(dsr, 1:2=>fmtfun2)
semi1 = semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true])
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [false, true], method = :hash)
semi2 = semijoin(dsl, dsr, on = [:x1, :x2], accelerate = true, mapformats = [false, true])
@test semi1 == dsl
@test semi2 == dsl
inn1 = innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true)
out1 = outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true)
left1 = leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, method = :hash)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, threads = false)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, threads = false)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], stable = true, method = :hash, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, threads = false)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [false, true], accelerate = true, stable =true, method = :hash, threads = false)
@test inn1 == out1 == left1
x1 = -rand(1:1000, 5000)
x2 = -rand(1:100, 5000)
y = rand(5000)
y2 = rand(5000)
dsl = Dataset(x1 = Characters{6}.(c"id" .* string.(-x1)), x2 = Characters{5}.(c"id" .* string.(-x2)), y = y)
dsr = Dataset(x1 = x1, x2 = x2, y2 = y2)
for i in 1:2
dsl[!, i] = PooledArray(dsl[!, i])
dsr[!, i] = PooledArray(dsr[!, i])
end
fmtfun3(x) = @views -parse(Int, x[3:end])
setformat!(dsl, 1:2=>fmtfun3)
semi1 = semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false])
@test semi1 == semijoin(dsl, dsr, on = [:x1, :x2], mapformats = [true, false], method = :hash)
semi2 = semijoin(dsl, dsr, on = [:x1, :x2], accelerate = true, mapformats = [true, false])
@test semi1 == dsl
@test semi2 == dsl
inn1 = innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
out1 = outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true)
left1 = leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true)
@test inn1 == innerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test out1 == outerjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], stable = true, method = :hash)
@test left1 == leftjoin(dsl, dsr, on =[:x1, :x2], mapformats = [true, false], accelerate = true, stable =true, method = :hash)
@test inn1 == out1 == left1
dsl = Dataset(x = [1,1,1,2,2,2], y = PooledArray([6,4,1,2,5,3]))
dsr = Dataset(x = [1,1,2], y = PooledArray([0,3,1]), z=[100,200,300])
@test closejoin(dsl, dsr, on = [:x, :y], makeunique = true) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[200,200,100, 300,300,300])
@test closejoin(dsl, dsr, on = [:x, :y], makeunique = true, direction = :forward) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[missing, missing, 200, missing, missing, missing])
@test closejoin(dsl, dsr, on = [:x, :y], makeunique = true, direction = :forward, border = :nearest) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[200,200,200, 300,300,300])
@test closejoin(dsl, dsr, on = [:x, :y], method = :hash, makeunique = true) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[200,200,100, 300,300,300])
@test closejoin(dsl, dsr, on = [:x, :y], method = :hash, makeunique = true, direction = :forward) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[missing, missing, 200, missing, missing, missing])
@test closejoin(dsl, dsr, on = [:x, :y], method = :hash, makeunique = true, direction = :forward, border = :nearest) == Dataset(x=[1,1,1,2,2,2], y=[6,4,1,2,5,3],z=[200,200,200, 300,300,300])