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

Function test_declaration

python/pyarrow/tests/test_acero.py:55–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53
54
55def test_declaration():
56
57 table = pa.table({'a': [1, 2, 3], 'b': [4, 5, 6]})
58 table_opts = TableSourceNodeOptions(table)
59 filter_opts = FilterNodeOptions(field('a') > 1)
60
61 # using sequence
62 decl = Declaration.from_sequence([
63 Declaration("table_source", options=table_opts),
64 Declaration("filter", options=filter_opts)
65 ])
66 result = decl.to_table()
67 assert result.equals(table.slice(1, 2))
68
69 # using explicit inputs
70 table_source = Declaration("table_source", options=table_opts)
71 filtered = Declaration("filter", options=filter_opts, inputs=[table_source])
72 result = filtered.to_table()
73 assert result.equals(table.slice(1, 2))
74
75
76def test_declaration_repr(table_source):

Callers

nothing calls this directly

Calls 6

TableSourceNodeOptionsFunction · 0.90
fieldFunction · 0.90
DeclarationClass · 0.90
equalsMethod · 0.80
to_tableMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected