aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/resources/sql-tests/results/struct.sql.out
blob: 3e32f46195464d584885b7ac8e7ad1342cff476e (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 6


-- !query 0
CREATE TEMPORARY VIEW tbl_x AS VALUES
  (1, NAMED_STRUCT('C', 'gamma', 'D', 'delta')),
  (2, NAMED_STRUCT('C', 'epsilon', 'D', 'eta')),
  (3, NAMED_STRUCT('C', 'theta', 'D', 'iota'))
  AS T(ID, ST)
-- !query 0 schema
struct<>
-- !query 0 output



-- !query 1
SELECT STRUCT('alpha', 'beta') ST
-- !query 1 schema
struct<ST:struct<col1:string,col2:string>>
-- !query 1 output
{"col1":"alpha","col2":"beta"}


-- !query 2
SELECT STRUCT('alpha' AS A, 'beta' AS B) ST
-- !query 2 schema
struct<ST:struct<A:string,B:string>>
-- !query 2 output
{"A":"alpha","B":"beta"}


-- !query 3
SELECT ID, STRUCT(ST.*) NST FROM tbl_x
-- !query 3 schema
struct<ID:int,NST:struct<C:string,D:string>>
-- !query 3 output
1	{"C":"gamma","D":"delta"}
2	{"C":"epsilon","D":"eta"}
3	{"C":"theta","D":"iota"}


-- !query 4
SELECT ID, STRUCT(ST.*,CAST(ID AS STRING) AS E) NST FROM tbl_x
-- !query 4 schema
struct<ID:int,NST:struct<C:string,D:string,E:string>>
-- !query 4 output
1	{"C":"gamma","D":"delta","E":"1"}
2	{"C":"epsilon","D":"eta","E":"2"}
3	{"C":"theta","D":"iota","E":"3"}


-- !query 5
SELECT ID, STRUCT(CAST(ID AS STRING) AS AA, ST.*) NST FROM tbl_x
-- !query 5 schema
struct<ID:int,NST:struct<AA:string,C:string,D:string>>
-- !query 5 output
1	{"AA":"1","C":"gamma","D":"delta"}
2	{"AA":"2","C":"epsilon","D":"eta"}
3	{"AA":"3","C":"theta","D":"iota"}