Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a field of type Array(Nullable(DateTime64(3))) contains "0001-01-01 00:00:00", the query will report year 0 is out of range #447

Open
Jxika opened this issue Jul 31, 2024 · 2 comments

Comments

@Jxika
Copy link

Jxika commented Jul 31, 2024

Describe the bug
When a field of type Array(Nullable(DateTime64(3))) contains "0001-01-01 00:00:00", the query will report year 0 is out of range

To Reproduce
cursor=conn.cursor()
cursor.execute(" select update from user ")
rows=cursor.fetchall()

Expected behavior
Can find "0001-01-01 00:00:00"

Versions

  • clickhouse-driver : 0.27
  • clickhouse : 21.9.2.17
  • python: 3.8
@xzkostyan
Copy link
Member

Please provide full steps to reproduce the problem.

docker run  -p 59000:9000 yandex/clickhouse-server:21.9.2.17
3ff03b478e26 :) create table test_1 (col Array(Nullable(DateTime64(3)))) Engine = Memory;

CREATE TABLE test_1
(
    `col` Array(Nullable(DateTime64(3)))
)
ENGINE = Memory

Query id: 5ee69b81-62d4-4587-97b1-edbd3dedceca

Ok.

0 rows in set. Elapsed: 0.005 sec. 

3ff03b478e26 :) INSERT INTO test_1 VALUES (['0001-01-01 00:00:00']);

INSERT INTO test_1 FORMAT Values

Query id: 4befd1b6-494a-4c6f-9e9e-712f89e2f28e

Ok.

1 row in set. Elapsed: 0.003 sec. 

3ff03b478e26 :) select * from test_1;

SELECT *
FROM test_1

Query id: b3b311cf-bd7c-48db-a5e1-1ad3c549eea3

   ┌─col─────────────────────────┐
1. │ ['1900-01-01 00:00:00.000'] │
   └─────────────────────────────┘

1 row in set. Elapsed: 0.002 sec. 

@Jxika
Copy link
Author

Jxika commented Aug 15, 2024

this is full steps:
step1:create table test_clickhouse (col Array(Nullable(DateTime64(3)))) Engine = MergeTree ORDER BY (col)
SETTINGS index_granularity = 8192;
step2:INSERT INTO test_clickhouse VALUES ([-62167219200000]);
step3:
image
image
image
step4:

from clickhouse_driver import connect

conn=connect(host='', port=9000, database='',user='' ,password='**' );
cursor = conn.cursor()
cursor.execute('select * from test_clickhouse')
rows = cursor.fetchall()
image

Versions

clickhouse-driver : 0.27
clickhouse : 21.9.2.17
python: 3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants