Skip to content

Commit 82b2416

Browse files
committed
fixes
1 parent 7dd9702 commit 82b2416

File tree

2 files changed

+190
-1
lines changed

2 files changed

+190
-1
lines changed

src/query_farm_server_base/duckdb_serialized_values.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ def sql(self) -> str:
955955
| Annotated[SerializedValue_integer, Tag("INTEGER")]
956956
| Annotated[SerializedValue_interval, Tag("INTERVAL")]
957957
| Annotated[SerializedValue_list, Tag("LIST")]
958-
| Annotated[SerializedValue_list, Tag("MAP")]
958+
| Annotated[SerializedValue_map, Tag("MAP")]
959959
| Annotated[SerializedValue_null, Tag("NULL")]
960960
| Annotated[SerializedValue_smallint, Tag("SMALLINT")]
961961
| Annotated[SerializedValue_struct, Tag("STRUCT")]

src/query_farm_server_base/test_duckdb_serialized_expression.py

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,195 @@
2020
@pytest.mark.parametrize(
2121
"parser_cls,input",
2222
[
23+
(
24+
duckdb_serialized_values.ExpressionBoundConstant,
25+
{
26+
"expression_class": "BOUND_CONSTANT",
27+
"type": "VALUE_CONSTANT",
28+
"alias": "",
29+
"query_location": 18446744073709552000,
30+
"value": {
31+
"type": {
32+
"id": "MAP",
33+
"type_info": {
34+
"type": "LIST_TYPE_INFO",
35+
"alias": "",
36+
"extension_info": None,
37+
"child_type": {
38+
"id": "STRUCT",
39+
"type_info": {
40+
"type": "STRUCT_TYPE_INFO",
41+
"alias": "",
42+
"extension_info": None,
43+
"child_types": [
44+
{
45+
"first": "key",
46+
"second": {"id": "VARCHAR", "type_info": None},
47+
},
48+
{
49+
"first": "value",
50+
"second": {"id": "VARCHAR", "type_info": None},
51+
},
52+
],
53+
},
54+
},
55+
},
56+
},
57+
"is_null": False,
58+
"value": {
59+
"children": [
60+
{
61+
"type": {
62+
"id": "STRUCT",
63+
"type_info": {
64+
"type": "STRUCT_TYPE_INFO",
65+
"alias": "",
66+
"extension_info": None,
67+
"child_types": [
68+
{
69+
"first": "key",
70+
"second": {"id": "VARCHAR", "type_info": None},
71+
},
72+
{
73+
"first": "value",
74+
"second": {"id": "VARCHAR", "type_info": None},
75+
},
76+
],
77+
},
78+
},
79+
"is_null": False,
80+
"value": {
81+
"children": [
82+
{
83+
"type": {"id": "VARCHAR", "type_info": None},
84+
"is_null": False,
85+
"value": "color",
86+
},
87+
{
88+
"type": {"id": "VARCHAR", "type_info": None},
89+
"is_null": False,
90+
"value": "red",
91+
},
92+
]
93+
},
94+
}
95+
]
96+
},
97+
},
98+
},
99+
),
100+
(
101+
duckdb_serialized_values.ExpressionBoundFunction,
102+
{
103+
"expression_class": "BOUND_FUNCTION",
104+
"type": "BOUND_FUNCTION",
105+
"alias": "",
106+
"query_location": 40,
107+
"return_type": {
108+
"id": "STRUCT",
109+
"type_info": {
110+
"type": "STRUCT_TYPE_INFO",
111+
"alias": "",
112+
"extension_info": None,
113+
"child_types": [
114+
{"first": "color", "second": {"id": "VARCHAR", "type_info": None}}
115+
],
116+
},
117+
},
118+
"children": [
119+
{
120+
"expression_class": "BOUND_FUNCTION",
121+
"type": "BOUND_FUNCTION",
122+
"alias": "color",
123+
"query_location": 49,
124+
"return_type": {"id": "VARCHAR", "type_info": None},
125+
"children": [
126+
{
127+
"expression_class": "BOUND_COLUMN_REF",
128+
"type": "BOUND_COLUMN_REF",
129+
"alias": "mapping",
130+
"query_location": 18446744073709552000,
131+
"return_type": {
132+
"id": "MAP",
133+
"type_info": {
134+
"type": "LIST_TYPE_INFO",
135+
"alias": "",
136+
"extension_info": None,
137+
"child_type": {
138+
"id": "STRUCT",
139+
"type_info": {
140+
"type": "STRUCT_TYPE_INFO",
141+
"alias": "",
142+
"extension_info": None,
143+
"child_types": [
144+
{
145+
"first": "key",
146+
"second": {
147+
"id": "VARCHAR",
148+
"type_info": None,
149+
},
150+
},
151+
{
152+
"first": "value",
153+
"second": {
154+
"id": "VARCHAR",
155+
"type_info": None,
156+
},
157+
},
158+
],
159+
},
160+
},
161+
},
162+
},
163+
"binding": {"table_index": 0, "column_index": 0},
164+
"depth": 0,
165+
},
166+
{
167+
"expression_class": "BOUND_CONSTANT",
168+
"type": "VALUE_CONSTANT",
169+
"alias": "",
170+
"query_location": 18446744073709552000,
171+
"value": {
172+
"type": {"id": "VARCHAR", "type_info": None},
173+
"is_null": False,
174+
"value": "color",
175+
},
176+
},
177+
],
178+
"name": "map_extract_value",
179+
"arguments": [
180+
{"id": "ANY", "type_info": None},
181+
{"id": "VARCHAR", "type_info": None},
182+
],
183+
"original_arguments": [],
184+
"catalog_name": "system",
185+
"schema_name": "main",
186+
"has_serialize": False,
187+
"is_operator": False,
188+
}
189+
],
190+
"name": "struct_pack",
191+
"arguments": [],
192+
"original_arguments": [],
193+
"catalog_name": "system",
194+
"schema_name": "main",
195+
"has_serialize": True,
196+
"function_data": {
197+
"variable_return_type": {
198+
"id": "STRUCT",
199+
"type_info": {
200+
"type": "STRUCT_TYPE_INFO",
201+
"alias": "",
202+
"extension_info": None,
203+
"child_types": [
204+
{"first": "color", "second": {"id": "VARCHAR", "type_info": None}}
205+
],
206+
},
207+
}
208+
},
209+
"is_operator": False,
210+
},
211+
),
23212
(
24213
duckdb_serialized_values.SerializedValueType_map,
25214
{

0 commit comments

Comments
 (0)