Skip to content

Commit 47b4824

Browse files
committed
fixes
1 parent 9dbb92d commit 47b4824

2 files changed

Lines changed: 82 additions & 1 deletion

File tree

src/query_farm_server_base/duckdb_serialized_values.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SerializedValueValue_base64(BaseModel):
3333
class SerializedValueTypeInfo_list(BaseModel):
3434
alias: str
3535
child_type: "AllValidTypeIdAndInfo"
36-
modifiers: list[Any]
36+
# modifiers: list[Any] | None = None
3737
type: Literal["LIST_TYPE_INFO"] = "LIST_TYPE_INFO"
3838

3939

@@ -1088,6 +1088,7 @@ class ExpressionBoundFunctionFunctionData(BaseModel):
10881088

10891089
class ExpressionBoundFunction(ExpressionBase):
10901090
expression_class: Literal["BOUND_FUNCTION"] = "BOUND_FUNCTION"
1091+
type: Literal["BOUND_FUNCTION"] = "BOUND_FUNCTION"
10911092
name: str
10921093
return_type: AllValidTypeIdAndInfo
10931094
children: list[AnyExpression]

src/query_farm_server_base/test_duckdb_serialized_expression.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55

66
from . import duckdb_serialized_expression
7+
from . import duckdb_serialized_values
78

89
owner_type_info = {
910
"Owner": 'STRUCT("DisplayName" VARCHAR,"ID" VARCHAR)',
@@ -16,6 +17,85 @@
1617
}
1718

1819

20+
@pytest.mark.parametrize(
21+
"parser_cls,input",
22+
[
23+
(
24+
duckdb_serialized_values.SerializedValueType_list,
25+
{
26+
"id": "LIST",
27+
"type_info": {
28+
"type": "LIST_TYPE_INFO",
29+
"alias": "",
30+
"extension_info": None,
31+
"child_type": {"id": "INTEGER", "type_info": None},
32+
},
33+
},
34+
),
35+
(
36+
duckdb_serialized_values.ExpressionBoundFunction,
37+
{
38+
"expression_class": "BOUND_FUNCTION",
39+
"type": "BOUND_FUNCTION",
40+
"alias": "",
41+
"query_location": 18446744073709552000,
42+
"return_type": {"id": "INTEGER", "type_info": None},
43+
"children": [
44+
{
45+
"expression_class": "BOUND_COLUMN_REF",
46+
"type": "BOUND_COLUMN_REF",
47+
"alias": "switches",
48+
"query_location": 18446744073709552000,
49+
"return_type": {
50+
"id": "LIST",
51+
"type_info": {
52+
"type": "LIST_TYPE_INFO",
53+
"alias": "",
54+
"extension_info": None,
55+
"child_type": {"id": "INTEGER", "type_info": None},
56+
},
57+
},
58+
"binding": {"table_index": 0, "column_index": 0},
59+
"depth": 0,
60+
},
61+
{
62+
"expression_class": "BOUND_CONSTANT",
63+
"type": "VALUE_CONSTANT",
64+
"alias": "",
65+
"query_location": 18446744073709552000,
66+
"value": {
67+
"type": {"id": "BIGINT", "type_info": None},
68+
"is_null": False,
69+
"value": 0,
70+
},
71+
},
72+
],
73+
"name": "array_extract",
74+
"arguments": [
75+
{
76+
"id": "LIST",
77+
"type_info": {
78+
"type": "LIST_TYPE_INFO",
79+
"alias": "",
80+
"extension_info": None,
81+
"child_type": {"id": "INTEGER", "type_info": None},
82+
},
83+
},
84+
{"id": "BIGINT", "type_info": None},
85+
],
86+
"original_arguments": [],
87+
"catalog_name": "system",
88+
"schema_name": "main",
89+
"has_serialize": False,
90+
"is_operator": False,
91+
},
92+
),
93+
],
94+
)
95+
def test_parse(parser_cls: Any, input: dict[str, Any]) -> None:
96+
parser_cls.model_validate(input)
97+
98+
1999
@pytest.mark.parametrize(
20100
"json_source,expected_sql,expected_bound_types",
21101
[

0 commit comments

Comments
 (0)