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
944 stars 410 forks source link

Cannot create table from metadata file #9124

Open z070204z opened 4 months ago

z070204z commented 4 months ago

[2024/06/05 16:11:18.690 +08:00] [ERROR] [] ["DB::Exception: Cannot create table from metadata file /data/deploy/install/data/tiflash-9000/metadata/db_1077654/t_1487435.sql, error: DB::Exception: Cannot parse string 'CURRENTDATE' as MyDate: syntax error at position 8 (parsed just 'CURRENT'), stack trace:\n\n 0x1c54f3e\tDB::Exception::Exception(std::1::basic_string<char, std::__1::char_traits, std::1::allocator > const&, int) [tiflash+29708094]

/data/deploy/install/data/tiflash-9000/metadata/db_1077654/t_1487435.sql: ATTACH TABLE t_1487435 ( id Int32, company Nullable(String), illegal_person Nullable(String), original_qualifications_levels Nullable(String), now_qualifications_levels Nullable(String), registered_capital Nullable(String), dataid Nullable(String), declaration_type Nullable(String), declaration_time Nullable(String), annex_path Nullable(String), annex_web_url Nullable(String), dataid_new Nullable(String), q data_caiji Nullable(MyDate) DEFAULT CAST('CURRENT_DATE' AS Nullable(MyDate)), apt_code Nullable(String), apt_code_date Nullable(MyDate), project_name Nullable(String), project_id Nullable(String), company_id Nullable(String), company_name Nullable(String), apt_name Nullable(String) ) ENGINE = DeltaMerge(id,

z070204z commented 4 months ago

version:7.1.2

JaySon-Huang commented 3 months ago

Hi @z070204z , Can you post the CREATE TABLE statement of the table with table_id=1487435 to this issue?

You can find out the table_schema and table_name by executing following statement on tidb. Then execute show create table xxx to get the CREATE TABLE statement.

select table_schema,table_name,'' as partition_name,tidb_table_id from information_schema.`tables`
where tidb_table_id = 1487435
union
select table_schema,table_name,partition_name,tidb_partition_id from information_schema.`partitions`
where tidb_partition_id = 1487435