aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/join/convert_key.sql
blob: 0d5ca60885005d45c7f1bc90d89c919041109db3 (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
/* postgres can not */
USE plato;

PRAGMA SimpleColumns;
pragma yt.MapJoinLimit="1m";

$join_result = 
(
    SELECT
        i1.k1 as i1_k1,
        i1.k2 as i1_k2,
        i1.value as i1_value,
        i2.k1 as i2_k1,
        i2.k2 as i2_k2,
        i2.value as i2_value
    FROM
        Input as i1
    LEFT JOIN
        (
            SELECT
                i2.value as value,
                cast(i2.k1 as double) as k1,
                cast(i2.k2 as double) as k2
            FROM Input as i2
        ) as i2
    ON
        i1.k1 == i2.k1 AND
        i1.k2 == i2.k2
);

SELECT * FROM $join_result;