aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/blocks/block_input_sys_columns.sql
blob: 2ab38cdf00feb68510190d06fd89274117206e50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
USE plato;

PRAGMA yt.JobBlockInput;

$a = (
    SELECT TableName() AS table_name, TableRecordIndex() AS record_index, Input1.* FROM Input1
    UNION ALL
    SELECT TableName() AS table_name, TableRecordIndex() AS record_index, Input2.* FROM Input2
);

$b = (
    SELECT * FROM Input1 AS users
    UNION ALL
    SELECT * FROM Input2 AS users
);

SELECT * FROM $a ORDER BY table_name, record_index;
SELECT ROW_NUMBER() OVER () AS row_num, b.* FROM $b AS b ORDER BY row_num;