Skip to content

Commit 0911fa4

Browse files
committed
fixed some more test failures
1 parent 4d7e6ff commit 0911fa4

3 files changed

Lines changed: 10 additions & 7 deletions

File tree

src/duckdb_py/pyexpression.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,10 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::LambdaExpression(const py::ob
409409
throw py::value_error("Please provide 'lhs' as either a tuple containing strings, or a single string");
410410
}
411411
auto lambda_expression = make_uniq<duckdb::LambdaExpression>(std::move(lhs), rhs.GetExpression().Copy());
412+
// Use the modern `lambda x, y: ...` syntax. The lhs we built (a column ref, or a `row` function for multiple
413+
// parameters) is identical to what the named-parameter constructor produces; only the syntax type differs, and
414+
// the single-arrow form is now deprecated and errors by default.
415+
lambda_expression->GetLambdaSyntaxTypeMutable() = LambdaSyntaxType::LAMBDA_KEYWORD;
412416
return make_shared_ptr<DuckDBPyExpression>(std::move(lambda_expression));
413417
}
414418

tests/fast/api/test_duckdb_query.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ def test_named_param(self):
9191
def test_named_param_not_dict(self):
9292
con = duckdb.connect()
9393

94+
# The missing-parameter names come from an unordered set, so their order is not stable; match all three
95+
# regardless of order.
9496
with pytest.raises(
9597
duckdb.InvalidInputException,
96-
match="Values were not provided for the following prepared statement parameters: name1, name2, name3",
98+
match=r"prepared statement parameters: (?=.*\bname1\b)(?=.*\bname2\b)(?=.*\bname3\b)",
9799
):
98100
con.execute("select $name1, $name2, $name3", ["name1", "name2", "name3"])
99101

@@ -126,9 +128,10 @@ def test_named_param_excessive(self):
126128
def test_named_param_not_named(self):
127129
con = duckdb.connect()
128130

131+
# Unordered set: match both missing parameters regardless of order.
129132
with pytest.raises(
130133
duckdb.InvalidInputException,
131-
match="Values were not provided for the following prepared statement parameters: 1, 2",
134+
match=r"prepared statement parameters: (?=.*\b1\b)(?=.*\b2\b)",
132135
):
133136
con.execute("select $1, $1, $2", {"name1": 5, "name2": 3})
134137

tests/fast/arrow/test_arrow_types.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ def test_null_type(self, duckdb_cursor):
1313
arrow_table = pa.Table.from_arrays(inputs, schema=schema)
1414
duckdb_cursor.register("testarrow", arrow_table)
1515
rel = duckdb.from_arrow(arrow_table).to_arrow_table()
16-
# We turn it to an array of int32 nulls
17-
schema = pa.schema([("data", pa.int32())])
18-
inputs = [pa.array([None, None, None], type=pa.null())]
19-
arrow_table = pa.Table.from_arrays(inputs, schema=schema)
20-
16+
# NULL type now round-trips faithfully (previously it was coerced to int32)
2117
assert rel["data"] == arrow_table["data"]
2218

2319
def test_invalid_struct(self, duckdb_cursor):

0 commit comments

Comments
 (0)