jorisvandenbossche commented on code in PR #40341:
URL: https://github.com/apache/arrow/pull/40341#discussion_r1512277241


##########
python/pyarrow/array.pxi:
##########
@@ -339,8 +339,12 @@ def array(object obj, type=None, mask=None, size=None, 
from_pandas=None,
             result = _ndarray_to_array(values, mask, type, c_from_pandas, safe,
                                        pool)
     else:
+        if type and type.id == _Type_RUN_END_ENCODED:
+            from pyarrow.compute import run_end_encode
+            result = run_end_encode(obj)

Review Comment:
   We should ensure that we actually honor the values type of the REE type. Eg 
if using `pa.run_end_encoded(run_end_type=pa.int32(), 
value_type=pa.float64())`, the result should use that exact type, and not 
whatever is inferred by `pc.run_end_encode`



##########
python/pyarrow/tests/test_array.py:
##########
@@ -3579,6 +3579,18 @@ def test_run_end_encoded_from_buffers():
                                            1, offset, children)
 
 
+def test_run_end_encoded_from_array_with_type():
+    arr = [1, 2, 2, 3, 3, 3]

Review Comment:
   This will also have to work for other kinds of inputs (eg np.ndarray instead 
of a python list)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to