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

Function test_concat_tables_with_promotion

python/pyarrow/tests/test_table.py:2131–2150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2129
2130
2131def test_concat_tables_with_promotion():
2132 t1 = pa.Table.from_arrays(
2133 [pa.array([1, 2], type=pa.int64())], ["int64_field"])
2134 t2 = pa.Table.from_arrays(
2135 [pa.array([1.0, 2.0], type=pa.float32())], ["float_field"])
2136
2137 result = pa.concat_tables([t1, t2], promote_options="default")
2138
2139 assert result.equals(pa.Table.from_arrays([
2140 pa.array([1, 2, None, None], type=pa.int64()),
2141 pa.array([None, None, 1.0, 2.0], type=pa.float32()),
2142 ], ["int64_field", "float_field"]))
2143
2144 t3 = pa.Table.from_arrays(
2145 [pa.array([1, 2], type=pa.int32())], ["int64_field"])
2146 result = pa.concat_tables(
2147 [t1, t3], promote_options="permissive")
2148 assert result.equals(pa.Table.from_arrays([
2149 pa.array([1, 2, 1, 2], type=pa.int64()),
2150 ], ["int64_field"]))
2151
2152
2153def test_concat_tables_with_promotion_error():

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected