pingcap / tiflash

The analytical engine for TiDB and TiDB Cloud. Try free: https://tidbcloud.com/free-trial
https://docs.pingcap.com/tidb/stable/tiflash-overview
Apache License 2.0
936 stars 409 forks source link

Illegal column Int64 of first argument of function hour #9175

Closed JinheLin closed 2 days ago

JinheLin commented 3 days ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

# Create table
drop table if exists test.t;
create table if not exists test.t(a time(4), i int);

# Insert many rows
insert into test.t values('-000:10:10.123456', 1), ('000:11:11.123500', 2), ('000:12:12.123500', 3), ('000:13:13.123500', 4);
insert into test.t values('-001:10:10.123456', 1), ('001:11:11.123500', 2), ('001:12:12.123500', 3), ('001:13:13.123500', 4);
insert into test.t values('-002:10:10.123456', 1), ('002:11:11.123500', 2), ('002:12:12.123500', 3), ('002:13:13.123500', 4);
insert into test.t values('-003:10:10.123456', 1), ('003:11:11.123500', 2), ('003:12:12.123500', 3), ('003:13:13.123500', 4);
insert into test.t values('-004:10:10.123456', 1), ('004:11:11.123500', 2), ('004:12:12.123500', 3), ('004:13:13.123500', 4);
insert into test.t values('-005:10:10.123456', 1), ('005:11:11.123500', 2), ('005:12:12.123500', 3), ('005:13:13.123500', 4);
insert into test.t values('-006:10:10.123456', 1), ('006:11:11.123500', 2), ('006:12:12.123500', 3), ('006:13:13.123500', 4);
insert into test.t values('-007:10:10.123456', 1), ('007:11:11.123500', 2), ('007:12:12.123500', 3), ('007:13:13.123500', 4);
insert into test.t values('-008:10:10.123456', 1), ('008:11:11.123500', 2), ('008:12:12.123500', 3), ('008:13:13.123500', 4);
insert into test.t values('-009:10:10.123456', 1), ('009:11:11.123500', 2), ('009:12:12.123500', 3), ('009:13:13.123500', 4);
insert into test.t values('-010:10:10.123456', 1), ('010:11:11.123500', 2), ('010:12:12.123500', 3), ('010:13:13.123500', 4);
insert into test.t values('-011:10:10.123456', 1), ('011:11:11.123500', 2), ('011:12:12.123500', 3), ('011:13:13.123500', 4);
insert into test.t values('-012:10:10.123456', 1), ('012:11:11.123500', 2), ('012:12:12.123500', 3), ('012:13:13.123500', 4);
insert into test.t values('-013:10:10.123456', 1), ('013:11:11.123500', 2), ('013:12:12.123500', 3), ('013:13:13.123500', 4);
insert into test.t values('-014:10:10.123456', 1), ('014:11:11.123500', 2), ('014:12:12.123500', 3), ('014:13:13.123500', 4);
insert into test.t values('-015:10:10.123456', 1), ('015:11:11.123500', 2), ('015:12:12.123500', 3), ('015:13:13.123500', 4);
insert into test.t values('-016:10:10.123456', 1), ('016:11:11.123500', 2), ('016:12:12.123500', 3), ('016:13:13.123500', 4);
insert into test.t values('-017:10:10.123456', 1), ('017:11:11.123500', 2), ('017:12:12.123500', 3), ('017:13:13.123500', 4);
insert into test.t values('-018:10:10.123456', 1), ('018:11:11.123500', 2), ('018:12:12.123500', 3), ('018:13:13.123500', 4);
insert into test.t values('-019:10:10.123456', 1), ('019:11:11.123500', 2), ('019:12:12.123500', 3), ('019:13:13.123500', 4);
insert into test.t values('-020:10:10.123456', 1), ('020:11:11.123500', 2), ('020:12:12.123500', 3), ('020:13:13.123500', 4);
insert into test.t values('-021:10:10.123456', 1), ('021:11:11.123500', 2), ('021:12:12.123500', 3), ('021:13:13.123500', 4);
insert into test.t values('-022:10:10.123456', 1), ('022:11:11.123500', 2), ('022:12:12.123500', 3), ('022:13:13.123500', 4);
insert into test.t values('-023:10:10.123456', 1), ('023:11:11.123500', 2), ('023:12:12.123500', 3), ('023:13:13.123500', 4);
insert into test.t values('-024:10:10.123456', 1), ('024:11:11.123500', 2), ('024:12:12.123500', 3), ('024:13:13.123500', 4);
insert into test.t select * from test.t;
insert into test.t select * from test.t;
insert into test.t select * from test.t;
insert into test.t select * from test.t;
insert into test.t select * from test.t;
insert into test.t select * from test.t;
insert into test.t select * from test.t;

# Add TiFlash replica
alter table test.t set tiflash replica 1;

# Wait data syncing

# Query to TiFlash
set tidb_isolation_read_engines='tiflash'; select hour(a), i from test.t where a = '024:11:11.123500';

2. What did you expect to see? (Required)

+---------+------+
| hour(a) | i    |
+---------+------+
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
|      24 |    2 |
+---------+------+
128 rows in set (0.03 sec)

3. What did you see instead (Required)

ERROR 1105 (HY000): other error for mpp stream: Code: 44, e.displayText() = DB::Exception: Illegal column Int64 of first argument of function hour, e.what() = DB::Exception,

4. What is your TiFlash version? (Required)

./tiflash --version                                                                                                                                                                    
TiFlash
Release Version: v8.2.0-alpha-77-g29395e7b5
Edition:         Community
Git Commit Hash: 29395e7b51e9d685ebc072e85362b7fccaf8d475
Git Branch:      HEAD
UTC Build Time:  2024-06-28 10:28:01
Enable Features: jemalloc sm4(GmSSL) avx2 avx512 unwind thinlto
Profile:         RELWITHDEBINFO
Compiler:        clang++ 17.0.6

Raft Proxy
Git Commit Hash:   b8c00d3953fc847a4958cec69b69ad5aa45c8a6d
Git Commit Branch: HEAD
UTC Build Time:    2024-06-28 10:29:53
Rust Version:      rustc 1.77.0-nightly (89e2160c4 2023-12-27)
Storage Engine:    tiflash
Prometheus Prefix: tiflash_proxy_
Profile:           release
Enable Features:   external-jemalloc portable sse test-engine-kv-rocksdb test-engine-raft-raft-engine openssl-vendored portable sse test-engine-kv-rocksdb test-engine-raft-raft-engine openssl-vendored