MCPcopy Create free account
hub / github.com/apache/arrow / test_named_table_empty_names

Function test_named_table_empty_names

python/pyarrow/tests/test_substrait.py:284–323  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

282
283
284def test_named_table_empty_names():
285 test_table_1 = pa.Table.from_pydict({"x": [1, 2, 3]})
286
287 def table_provider(names, _):
288 if not names:
289 raise Exception("No names provided")
290 elif names[0] == "t1":
291 return test_table_1
292 else:
293 raise Exception("Unrecognized table name")
294
295 substrait_query = """
296 {
297 "version": { "major": 9999 },
298 "relations": [
299 {"rel": {
300 "read": {
301 "base_schema": {
302 "struct": {
303 "types": [
304 {"i64": {}}
305 ]
306 },
307 "names": [
308 "x"
309 ]
310 },
311 "namedTable": {
312 "names": []
313 }
314 }
315 }}
316 ]
317 }
318 """
319 query = tobytes(substrait_query)
320 buf = pa._substrait._parse_json_plan(tobytes(query))
321 exec_message = "names for NamedTable not provided"
322 with pytest.raises(ArrowInvalid, match=exec_message):
323 substrait.run_query(buf, table_provider=table_provider)
324
325
326@pytest.mark.parametrize("use_threads", [True, False])

Callers

nothing calls this directly

Calls 1

tobytesFunction · 0.85

Tested by

no test coverage detected