apache / apache/arrow-adbc

c/driver/postgresql: `adbc_ingest` fails for unsigned int and some temporal dtypes

Open
#1,950 11 comments 1 reaction 0 assignees View on GitHub
Type: bug
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### What happened?

`adbc_ingest` fails for any dataframe that contains an unsigned int dtype and some (but not all) temporal dtypes.

```python
import pyarrow as pa
from adbc_driver_postgresql import dbapi

uri = "postgresql://mcrumiller@winhost/mydb"

def try_ingest(data, dtype):
"""Attempt to write single-column df using ADBC."""
df = pa.Table.from_arrays([data], schema=pa.schema([("a", dtype)]))
conn = dbapi.connect(uri)
cur = conn.cursor()
try:
cur.adbc_ingest("test_dtype", df, mode="replace")
print(f"{dtype}: OK")
except Exception as e:
print(f"{dtype}: {e}")

# these all fail
try_ingest([0], pa.uint8())
try_ingest([0], pa.uint16())
try_ingest([0], pa.uint32())
try_ingest([0], pa.uint64())
try_ingest([0], dtype=pa.time32("s"))
try_ingest([0], dtype=pa.time32("ms"))
try_ingest([0], dtype=pa.time64("us"))
try_ingest([0], dtype=pa.time64("ns"))
try_ingest([0], dtype=pa.date64())

# these all pass
try_ingest([True, True, False], pa.bool_())
try_ingest([0], dtype=pa.int8())
try_ingest([0], dtype=pa.int16())
try_ingest([0], dtype=pa.int32())
try_ingest([0], dtype=pa.int64())
try_ingest([0], dtype=pa.float32())
try_ingest([0], dtype=pa.float64())
try_ingest([0], dtype=pa.timestamp("s"))
try_ingest([0], dtype=pa.timestamp("ms"))
try_ingest([0], dtype=pa.timestamp("us"))
try_ingest([0], dtype=pa.timestamp("ns"))
try_ingest([0], dtype=pa.duration("s"))
try_ingest([0], dtype=pa.duration("ms"))
try_ingest([0], dtype=pa.duration("us"))
try_ingest([0], dtype=pa.duration("ns"))
try_ingest([0], dtype=pa.date32())
try_ingest(["a", "b", "c"], pa.string())
try_ingest(["a", "b", "c"], pa.binary())
```
```
uint8: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion uint8
uint16: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion uint16
uint32: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion uint32
uint64: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion uint64
time32[s]: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion time32
time32[ms]: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion time32
time64[us]: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion time64
time64[ns]: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion time64
date64[ms]: NOT_IMPLEMENTED: [libpq] Field #1 ('a') has unsupported type for ingestion date64
bool: OK
int8: OK
int16: OK
int32: OK
int64: OK
float: OK
double: OK
timestamp[s]: OK
timestamp[ms]: OK
timestamp[us]: OK
timestamp[ns]: OK
duration[s]: OK
duration[ms]: OK
duration[us]: OK
duration[ns]: OK
date32[day]: OK
string: OK
binary: OK
```

### Environment/Setup

`adbc_driver_postgresql==1.0.0`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.