@@ -14,48 +14,44 @@ def adapter(make_mocked_engine_adapter):
1414 adapter = make_mocked_engine_adapter (RisingwaveEngineAdapter )
1515 return adapter
1616
17+
1718def test_columns (adapter : t .Callable ):
1819 adapter .cursor .fetchall .return_value = [
19- ("smallint_col" ,"smallint" ),
20- ("int_col" ,"integer" ),
21- ("bigint_col" ,"bigint" ),
22- ("ts_col" ,"timestamp without time zone" ),
23- ("tstz_col" ,"timestamp with time zone" ),
24- ("int_array_col" ,"integer[]" ),
25- ("vchar_col" ,"character varying" ),
26- ("struct_col" ,"struct<nested_col integer>" )
20+ ("smallint_col" , "smallint" ),
21+ ("int_col" , "integer" ),
22+ ("bigint_col" , "bigint" ),
23+ ("ts_col" , "timestamp without time zone" ),
24+ ("tstz_col" , "timestamp with time zone" ),
25+ ("int_array_col" , "integer[]" ),
26+ ("vchar_col" , "character varying" ),
27+ ("struct_col" , "struct<nested_col integer>" ),
2728 ]
2829 resp = adapter .columns ("db.table" )
2930 assert resp == {
30- "smallint_col" : exp .DataType .build (exp .DataType .Type .SMALLINT ,nested = False ),
31- "int_col" : exp .DataType .build (exp .DataType .Type .INT ,nested = False ),
32- "bigint_col" : exp .DataType .build (exp .DataType .Type .BIGINT ,nested = False ),
33- "ts_col" : exp .DataType .build (exp .DataType .Type .TIMESTAMP ,nested = False ),
34- "tstz_col" : exp .DataType .build (exp .DataType .Type .TIMESTAMPTZ ,nested = False ),
35- "int_array_col" : exp .DataType .build (
36- exp .DataType .Type .ARRAY ,
37- expressions = [exp .DataType .build (exp .DataType .Type .INT ,nested = False )],
38- nested = True
39- ),
31+ "smallint_col" : exp .DataType .build (exp .DataType .Type .SMALLINT , nested = False ),
32+ "int_col" : exp .DataType .build (exp .DataType .Type .INT , nested = False ),
33+ "bigint_col" : exp .DataType .build (exp .DataType .Type .BIGINT , nested = False ),
34+ "ts_col" : exp .DataType .build (exp .DataType .Type .TIMESTAMP , nested = False ),
35+ "tstz_col" : exp .DataType .build (exp .DataType .Type .TIMESTAMPTZ , nested = False ),
36+ "int_array_col" : exp .DataType .build (
37+ exp .DataType .Type .ARRAY ,
38+ expressions = [exp .DataType .build (exp .DataType .Type .INT , nested = False )],
39+ nested = True ,
40+ ),
4041 "vchar_col" : exp .DataType .build (exp .DataType .Type .VARCHAR ),
4142 "struct_col" : exp .DataType .build (
42- exp .DataType .Type .STRUCT ,
43- expressions = [
44- exp .ColumnDef (
45- this = exp .Identifier (
46- this = "nested_col" ,
47- quoted = False
48- ),
49- kind = exp .DataType .build (
50- exp .DataType .Type .INT ,
51- nested = False
52- )
53- )
54- ],
55- nested = True
56- ),
43+ exp .DataType .Type .STRUCT ,
44+ expressions = [
45+ exp .ColumnDef (
46+ this = exp .Identifier (this = "nested_col" , quoted = False ),
47+ kind = exp .DataType .build (exp .DataType .Type .INT , nested = False ),
48+ )
49+ ],
50+ nested = True ,
51+ ),
5752 }
5853
54+
5955def test_create_view (adapter : t .Callable ):
6056 adapter .create_view ("db.view" , parse_one ("SELECT 1" ), replace = True )
6157 adapter .create_view ("db.view" , parse_one ("SELECT 1" ), replace = False )
0 commit comments