@@ -423,12 +423,28 @@ def compile_aggregation(t, expr, scope, timecontext, **kwargs):
423
423
@compiles (ops .Union )
424
424
def compile_union (t , expr , scope , timecontext , ** kwargs ):
425
425
op = expr .op ()
426
- result = t .translate (op .left , scope , timecontext ). union (
427
- t .translate (op .right , scope , timecontext )
428
- )
426
+ left = t .translate (op .left , scope , timecontext , ** kwargs )
427
+ right = t .translate (op .right , scope , timecontext , ** kwargs )
428
+ result = left . union ( right )
429
429
return result .distinct () if op .distinct else result
430
430
431
431
432
+ @compiles (ops .Intersection )
433
+ def compile_intersection (t , expr , scope , timecontext , ** kwargs ):
434
+ op = expr .op ()
435
+ left = t .translate (op .left , scope , timecontext , ** kwargs )
436
+ right = t .translate (op .right , scope , timecontext , ** kwargs )
437
+ return left .intersect (right ) if op .distinct else left .intersectAll (right )
438
+
439
+
440
+ @compiles (ops .Difference )
441
+ def compile_difference (t , expr , scope , timecontext , ** kwargs ):
442
+ op = expr .op ()
443
+ left = t .translate (op .left , scope , timecontext , ** kwargs )
444
+ right = t .translate (op .right , scope , timecontext , ** kwargs )
445
+ return left .subtract (right ) if op .distinct else left .exceptAll (right )
446
+
447
+
432
448
@compiles (ops .Contains )
433
449
def compile_contains (t , expr , scope , timecontext , ** kwargs ):
434
450
op = expr .op ()
0 commit comments