Skip to content

Commit fa75f25

Browse files
committed
fix: use from_substrait in duckdb tests to get tests passing
the duckdb extension throws an error when unexpected fields are present in JSON on invocation of `from_substrait_json`. So we instead switch to using `from_substrait`.
1 parent 7be8c36 commit fa75f25

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/sql/test_sql_to_substrait.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from substrait.sql.sql_to_substrait import convert
22
import pyarrow
3-
from google.protobuf import json_format
43
import tempfile
54
import pyarrow.substrait as pa_substrait
65
import pytest
@@ -91,10 +90,9 @@ def duckdb_schema_resolver(name: str):
9190
conn.install_extension("substrait", repository="community")
9291
conn.load_extension("substrait")
9392

94-
plan_json = json_format.MessageToJson(plan)
95-
sql = f"CALL from_substrait_json('{plan_json}')"
93+
sql = "CALL from_substrait(?)"
94+
substrait_out = conn.sql(sql, params=[plan.SerializeToString()])
9695

97-
substrait_out = conn.sql(sql)
9896
sql_out = conn.sql(query)
9997

10098
substrait_arrow = substrait_out.arrow()
@@ -131,7 +129,6 @@ def test_select_field(engine: str):
131129
assert_query("""SELECT store_id FROM stores""", engine)
132130

133131

134-
@pytest.mark.xfail
135132
@pytest.mark.parametrize("engine", engines)
136133
def test_inner_join_filtered(engine: str):
137134
assert_query(
@@ -143,7 +140,7 @@ def test_inner_join_filtered(engine: str):
143140
engine,
144141
)
145142

146-
@pytest.mark.xfail
143+
147144
@pytest.mark.parametrize("engine", engines)
148145
def test_left_join(engine: str):
149146
assert_query(
@@ -154,7 +151,7 @@ def test_left_join(engine: str):
154151
engine,
155152
)
156153

157-
@pytest.mark.xfail
154+
158155
@pytest.mark.parametrize("engine", engines)
159156
def test_right_join(engine: str):
160157
assert_query(
@@ -176,7 +173,7 @@ def test_group_by_empty_measures(engine: str):
176173
engine,
177174
)
178175

179-
@pytest.mark.xfail
176+
180177
@pytest.mark.parametrize("engine", engines)
181178
def test_group_by_count(engine: str):
182179
assert_query(
@@ -187,7 +184,7 @@ def test_group_by_count(engine: str):
187184
engine,
188185
)
189186

190-
@pytest.mark.xfail
187+
191188
@pytest.mark.parametrize("engine", engines)
192189
def test_group_by_unnamed_expr(engine: str):
193190
assert_query(
@@ -198,7 +195,7 @@ def test_group_by_unnamed_expr(engine: str):
198195
engine,
199196
)
200197

201-
@pytest.mark.xfail
198+
202199
@pytest.mark.parametrize("engine", engines)
203200
def test_sum(engine: str):
204201
assert_query(
@@ -219,7 +216,7 @@ def test_group_by_hidden_dimension(engine: str):
219216
engine,
220217
)
221218

222-
@pytest.mark.xfail
219+
223220
@pytest.mark.parametrize("engine", engines)
224221
def test_group_by_having_no_duplicate(engine: str):
225222
assert_query(
@@ -231,7 +228,7 @@ def test_group_by_having_no_duplicate(engine: str):
231228
engine,
232229
)
233230

234-
@pytest.mark.xfail
231+
235232
@pytest.mark.parametrize("engine", engines)
236233
def test_group_by_having_duplicate(engine: str):
237234
assert_query(

0 commit comments

Comments
 (0)