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

Function test_declaration

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

Source from the content-addressed store, hash-verified

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