databend-py icon indicating copy to clipboard operation
databend-py copied to clipboard

bug: execute ignore type with null

Open TCeason opened this issue 10 months ago • 1 comments

Create table:

./target/debug/bendsql                                                                                                                                                                                ✔  eason@databend-arch1 
Welcome to BendSQL 0.17.0-1f08d67(2024-04-25T02:50:17.575815250Z).
Connecting to localhost:8000 as user root.
Connected to Databend Query v1.2.329-nightly-2e3459707e(rust-1.77.0-nightly-2024-04-24T06:04:56.359605219Z)

:) select * from t;
tuple res is Tuple([Nullable(Number(Int32)), Nullable(Nullable(String))])

SELECT
  *
FROM
  t

┌──────────────────────────────────────────────────────────────┐
│                              id                              │
│ Nullable(Tuple(Nullable(Int32), Nullable(Nullable(String)))) │
├──────────────────────────────────────────────────────────────┤
│ NULL                                                         │
└──────────────────────────────────────────────────────────────┘
1 row read in 0.084 sec. Processed 1 row, 31B (11.89 rows/s, 368B/s)

:) show create table t;

SHOW CREATE TABLE t

┌─────────────────────────────────────────────────────────────────────────────────────┐
│  Table │                                Create Table                                │
│ String │                                   String                                   │
├────────┼────────────────────────────────────────────────────────────────────────────┤
│ t      │ CREATE TABLE t (\n  id TUPLE(1 INT32, 2 ARRAY(STRING)) NULL\n) ENGINE=FUSE │
└─────────────────────────────────────────────────────────────────────────────────────┘
1 row read in 0.073 sec. Processed 0 row, 0B (0 row/s, 0B/s)

:) 
Bye~

The type of id is : Nullable(Tuple(Nullable(Int32), Nullable(Nullable(String))))

But in databend-py type of id is :Tuple(Int32 NULL, Array(String NULL

ignore a ) quote and The type is not null.

cat ~/a.py                                                                                                                                                                                  ✔  2m 5s   eason@databend-arch1 
#!/usr/bin/env python3


from databend_py import Client

client = Client.from_url("http://root:root@localhost:8000")
ct, res = client.execute('select * from t', with_column_types=True)
print(ct)
print(res)
    /data/eason/bendsql    main ⇡227 !1  python3 ~/a.py                                                                                                                                                                                        ✔  eason@databend-arch1 
[('id', 'Tuple(Int32 NULL, Array(String NULL')]
[('NULL',)]

TCeason avatar Apr 25 '24 03:04 TCeason

@TCeason The raw response in python is [{'name': 'id', 'type': 'Nullable(Tuple(Int32 NULL, Array(String NULL) NULL))'}] as shown in the following pic:

image

So I need to shown the colum type as : Nullable(Tuple(Int32 NULL, Array(String NULL) NULL))

hantmac avatar May 08 '24 07:05 hantmac