-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathtest_user_defined.py
More file actions
72 lines (67 loc) · 2.3 KB
/
Copy pathtest_user_defined.py
File metadata and controls
72 lines (67 loc) · 2.3 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
from tests.aggregate_tests.aggtst_base import TstView, TstTable
# Depth 1 tests
class cmpxtst_userdef_int_var_tbl(TstTable):
"""Define the table used by the user defined type tests"""
def __init__(self):
self.sql = """CREATE TYPE int_type AS(i1 INT NOT NULL, i2 INT);
CREATE TYPE var_type AS(v1 VARCHAR NOT NULL, v2 VARCHAR);
CREATE TABLE userdef_int_var_tbl(
id INT,
c1 int_type NOT NULL,
c2 int_type,
c3 var_type NOT NULL,
c4 var_type)"""
self.data = [
{
"id": 0,
"c1": {"i1": 1, "i2": None},
"c2": {"i1": 5, "i2": 6},
"c3": {"v1": "hi", "v2": None},
"c4": {"v1": "hello", "v2": None},
},
{
"id": 1,
"c1": {"i1": 1, "i2": 2},
"c2": {"i1": 5, "i2": None},
"c3": {"v1": "bye", "v2": None},
"c4": {"v1": "ciao", "v2": "adios"},
},
]
class cmpxtst_userdef_field_access(TstView):
def __init__(self):
# checked manually
self.data = [
{
"id": 0,
"i1": 1,
"i2": None,
"i10": 5,
"i20": 6,
"v1": "hi",
"v2": None,
"v10": "hello",
"v20": None,
},
{
"id": 1,
"i1": 1,
"i2": 2,
"i10": 5,
"i20": None,
"v1": "bye",
"v2": None,
"v10": "ciao",
"v20": "adios",
},
]
self.sql = """CREATE MATERIALIZED VIEW userdef_field_access AS SELECT
id,
userdef_int_var_tbl.c1.i1,
userdef_int_var_tbl.c1.i2,
userdef_int_var_tbl.c2.i1,
userdef_int_var_tbl.c2.i2,
userdef_int_var_tbl.c3.v1,
userdef_int_var_tbl.c3.v2,
userdef_int_var_tbl.c4.v1,
userdef_int_var_tbl.c4.v2
FROM userdef_int_var_tbl"""