Skip to content

Commit

Permalink
ARROW-14381: [CI][Python] Fix Spark integration failures
Browse files Browse the repository at this point in the history
I don't have a small reproducer, but either a pandas series or a dataframe gets passed as mask to `pa.array()`

Closes #11465 from kszucs/ARROW-14381

Authored-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
Signed-off-by: Krisztián Szűcs <szucs.krisztian@gmail.com>
  • Loading branch information
kszucs committed Oct 19, 2021
1 parent 0960fa6 commit bc223c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1246,8 +1246,9 @@ tasks:
image: conda-python-hdfs
{% endfor %}

{% for python_version, spark_version, test_pyarrow_only in [("3.7", "branch-3.0", "true"),
("3.8", "master", "false")] %}
{% for python_version, spark_version, test_pyarrow_only in [("3.7", "v3.1.2", "false"),
("3.8", "v3.2.0", "false"),
("3.9", "master", "false")] %}
test-conda-python-{{ python_version }}-spark-{{ spark_version }}:
ci: github
template: docker-tests/github.linux.yml
Expand Down
9 changes: 6 additions & 3 deletions python/pyarrow/array.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,12 @@ def array(object obj, type=None, mask=None, size=None, from_pandas=None,
if hasattr(obj, '__arrow_array__'):
return _handle_arrow_array_protocol(obj, type, mask, size)
elif _is_array_like(obj):
if mask is not None and not _is_array_like(mask):
raise TypeError("Mask must be a numpy array "
"when converting numpy arrays")
if mask is not None:
if _is_array_like(mask):
mask = get_values(mask, &is_pandas_object)
else:
raise TypeError("Mask must be a numpy array "
"when converting numpy arrays")

values = get_values(obj, &is_pandas_object)
if is_pandas_object and from_pandas is None:
Expand Down

0 comments on commit bc223c6

Please sign in to comment.