arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[Python] Scalar inferencing doesn't infer UUID

Open rohanjain101 opened this issue 1 month ago • 2 comments

Describe the bug, including details regarding any error messages, version, and platform.

>>> import uuid
>>> pa.scalar(uuid.uuid4())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyarrow/scalar.pxi", line 1673, in pyarrow.lib.scalar
    chunked = GetResultValue(ConvertPySequence(value, None, options, pool))
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
    return check_status(status)
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
    raise convert_status(status)
pyarrow.lib.ArrowInvalid: Could not convert UUID('69db4352-8da4-425b-bb36-0b2b35953f32') with type UUID: did not recognize Python value type when inferring an Arrow data type
>>> pa.scalar(uuid.uuid4().bytes, type=pa.uuid())
<pyarrow.UuidScalar: UUID('30897c0a-f649-4155-800a-ed6581f9c08f')>
>>> pa.scalar(uuid.uuid4().bytes, type=pa.uuid()).as_py()
UUID('f96615a8-dee4-4379-803d-a067225a166f')
>>>

But seems like it should be supported, since as_py for UUIDScalar returns it.

Component(s)

Python

rohanjain101 avatar Nov 24 '25 16:11 rohanjain101

@rok @AlenkaF @thisisnic

pitrou avatar Nov 25 '25 09:11 pitrou

I am currently looking into this and it appears that handling this scenario would resolve underlying problem of #44224 as well. (But might not directly resolve the newest item #48470.)

tadeja avatar Dec 12 '25 12:12 tadeja