aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/EquiJoin/Bug1924.sql
blob: b14b63a04ab5a6f9cf2730f47d5a9c9656622918 (plain) (blame)
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
USE plato;

$hash = (select key as devid, key as mmetric_devid from Input);
$rutaxi = (select key as DeviceID from Input);
$device = (select key as devid, key as yuid from Input);
$cripta = (select key as yuid, value as phones from Input);

$x = 
    (
    select 
        hash.devid as devid
        from $rutaxi as rutaxi
        right semi join $hash as hash
        on rutaxi.DeviceID = hash.mmetric_devid
    );

$y = 
    (
    select
        device.yuid as yuid
        from $x as x
        right semi join $device as device
        using(devid)
    );


$z = 
    (
    select
        cripta.phones as phones
        from $y as y
        right semi join $cripta as cripta on
            y.yuid = cripta.yuid || ""
    );
    
select 
    x.phones AS phone
from $z AS x;