You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clickhouse version: 19.8.3.8
Clickhouse driver version: 0.1.0
Create table sql is: create table example (date Date, info_id FixedString(16), create_time UInt32) ENGINE= MergeTree PARTITION BY date ORDER BY create_time SETTINGS index_granularity=8192
Then try to insert the data: insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('5d424f77-0c00-5789-848e-555969d0e7f1'), 1567498636) insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('2d124177-0c66-5789-848e-555969d0e7f1'), 1567498636) insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('2d124177-0c00-5789-848e-555969d0e7f1'), 1567498636)
The focus is on the info_id of the FixedString(16) type.
Query data is normal: select UUIDNumToString(info_id) as id from example
┌─id───────────────────────────────────┐
│ 5d424f77-0c00-5789-848e-555969d0e7f1 │
│ 2d124177-0c66-5789-848e-555969d0e7f1 │
│ 2d124177-0c00-5789-848e-555969d0e7f1 │
└──────────────────────────────────────┘
Use the python code to query as follows: from clickhouse_driver import Client c = Client('127.0.0.1', port=9000) rows = c.execute('select * from default.example')
Rows are shown in ipython as follows:
[(datetime.date(2019, 9, 3),
b'-\x12Aw\x0cfW\x89\x84\x8eUYi\xd0\xe7\xf1',
1567498636),
(datetime.date(2019, 9, 3), '-\x12Aw\x0c', 1567498636),
(datetime.date(2019, 9, 3), ']BOw\x0c', 1567498636)]
The returned part of the id seems to be truncated.
It seems that this problem occurs when the id contains 0c00. There is no such problem with the driver of version 0.0.19.
How to solve this? Thank you
The text was updated successfully, but these errors were encountered:
Hi. It seems to be valid bug during string decoding in 0.1.0. Thanks.
You can cast column to string as workaround:
In [2]: c.execute('select info_id from example')
Out[2]:
[(']BOw\x0c',),
(b'-\x12Aw\x0cfW\x89\x84\x8eUYi\xd0\xe7\xf1',),
('-\x12Aw\x0c',)]
In [3]: c.execute('select CAST(info_id AS String) from example')
Out[3]:
[(b']BOw\x0c\x00W\x89\x84\x8eUYi\xd0\xe7\xf1',),
(b'-\x12Aw\x0cfW\x89\x84\x8eUYi\xd0\xe7\xf1',),
(b'-\x12Aw\x0c\x00W\x89\x84\x8eUYi\xd0\xe7\xf1',)]
Or you can disable strings encoding/decoding:
In [4]: from clickhouse_driver import Client
...: c = Client('127.0.0.1', settings={'strings_as_bytes': True})
...: c.execute('select info_id from example')
Out[4]:
[(b']BOw\x0c\x00W\x89\x84\x8eUYi\xd0\xe7\xf1',),
(b'-\x12Aw\x0cfW\x89\x84\x8eUYi\xd0\xe7\xf1',),
(b'-\x12Aw\x0c\x00W\x89\x84\x8eUYi\xd0\xe7\xf1',)]
Clickhouse version: 19.8.3.8
Clickhouse driver version: 0.1.0
Create table sql is:
create table example (date Date, info_id FixedString(16), create_time UInt32) ENGINE= MergeTree PARTITION BY date ORDER BY create_time SETTINGS index_granularity=8192
Then try to insert the data:
insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('5d424f77-0c00-5789-848e-555969d0e7f1'), 1567498636)
insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('2d124177-0c66-5789-848e-555969d0e7f1'), 1567498636)
insert into example(date, info_id, create_time) values('2019-09-03', UUIDStringToNum('2d124177-0c00-5789-848e-555969d0e7f1'), 1567498636)
The focus is on the info_id of the FixedString(16) type.
Query data is normal:
select UUIDNumToString(info_id) as id from example
┌─id───────────────────────────────────┐
│ 5d424f77-0c00-5789-848e-555969d0e7f1 │
│ 2d124177-0c66-5789-848e-555969d0e7f1 │
│ 2d124177-0c00-5789-848e-555969d0e7f1 │
└──────────────────────────────────────┘
Use the python code to query as follows:
from clickhouse_driver import Client
c = Client('127.0.0.1', port=9000)
rows = c.execute('select * from default.example')
Rows are shown in ipython as follows:
[(datetime.date(2019, 9, 3),
b'-\x12Aw\x0cfW\x89\x84\x8eUYi\xd0\xe7\xf1',
1567498636),
(datetime.date(2019, 9, 3), '-\x12Aw\x0c', 1567498636),
(datetime.date(2019, 9, 3), ']BOw\x0c', 1567498636)]
The returned part of the id seems to be truncated.
It seems that this problem occurs when the id contains 0c00.
There is no such problem with the driver of version 0.0.19.
How to solve this? Thank you
The text was updated successfully, but these errors were encountered: