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

Function test_fill_null_chunked_array

python/pyarrow/tests/test_compute.py:2154–2179  ·  view source on GitHub ↗
(arrow_type)

Source from the content-addressed store, hash-verified

2152
2153@pytest.mark.parametrize('arrow_type', numerical_arrow_types)
2154def test_fill_null_chunked_array(arrow_type):
2155 fill_value = pa.scalar(5, type=arrow_type)
2156 arr = pa.chunked_array([pa.array([None, 2, 3, 4], type=arrow_type)])
2157 result = arr.fill_null(fill_value)
2158 expected = pa.chunked_array([pa.array([5, 2, 3, 4], type=arrow_type)])
2159 assert result.equals(expected)
2160
2161 arr = pa.chunked_array([
2162 pa.array([1, 2], type=arrow_type),
2163 pa.array([], type=arrow_type),
2164 pa.array([None, 4], type=arrow_type)
2165 ])
2166 expected = pa.chunked_array([
2167 pa.array([1, 2], type=arrow_type),
2168 pa.array([], type=arrow_type),
2169 pa.array([5, 4], type=arrow_type)
2170 ])
2171 result = arr.fill_null(fill_value)
2172 assert result.equals(expected)
2173
2174 # Implicit conversions
2175 result = arr.fill_null(5)
2176 assert result.equals(expected)
2177
2178 result = arr.fill_null(pa.scalar(5, type='int8'))
2179 assert result.equals(expected)
2180
2181
2182def test_fill_null_windows_regression():

Callers

nothing calls this directly

Calls 4

chunked_arrayMethod · 0.80
equalsMethod · 0.80
scalarMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected