Skip to content

[BUG] Syntax error in CREATE TABLE statement: skip indexes cause table creation to fail in ClickHouse #408

@night-ci

Description

@night-ci

📋 CheckList

  • I have searched existing issues to avoid duplicates
  • I am using a recently maintained version of Coze Loop
  • I have provided all required information
  • I understand this is a bug report and not a feature request
  • I have submitted this report in English (otherwise it will not be processed)

🐛 Bug Description

The CREATE TABLE expt_turn_result_filter statement in evaluation.sql contains a syntax error in the skip index definitions, which causes ClickHouse to fail during table creation.

🔄 Steps to Reproduce

run: make compose-up

✅ Expected Behavior

Successful execution

❌ Actual Behavior

service "clickhouse-init" didn't complete successfully: exit 62

🚨 Severity

Critical - System crash or data loss

🔧 Component

Infrastructure

💻 Environment

openCloudOS8.8

🔧 Go Environment

No response

📋 Logs

[root@VM-12-11-opencloudos docker-compose]# docker compose logs  clickhouse-init 
coze-loop-clickhouse-init  | *************************************************************************
coze-loop-clickhouse-init  | ****************************** Starting... ******************************
coze-loop-clickhouse-init  | *************************************************************************
coze-loop-clickhouse-init  | + init #1: < evaluation.sql
coze-loop-clickhouse-init  | Code: 62. DB::Exception: Syntax error: failed at position 787 ('INDEX') (line 25, col 5): INDEX idx_space_id space_id TYPE bloom_filter() GRANULARITY 1,
coze-loop-clickhouse-init  |     INDEX idx_expt_id expt_id TYPE bloom_filter() GRANULARITY 1,
coze-loop-clickhouse-init  |     INDEX idx_item_id item_id TY. Expected one of: COLLATE, NOT, NULL, DEFAULT, MATERIALIZED, ALIAS, EPHEMERAL, AUTO_INCREMENT, COMMENT, CODEC, TTL, PRIMARY KEY, token, Comma, ClosingRoundBracket. (SYNTAX_ERROR)

📝 Additional Context

In the open-source project's evaluation.sql initialization script, the CREATE TABLE expt_turn_result_filter statement contains a syntax error: the skip indexes are placed directly after the last column definition (evaluator_weighted_score Float64) without a preceding comma or proper separation as independent table elements. This violates ClickHouse’s CREATE TABLE syntax rules, which require all columns and indexes to be listed within the same parentheses and explicitly separated by commas. Due to this error, the ClickHouse parser throws an exception such as “Expected comma or closing parenthesis, got 'INDEX'” during execution, causing table creation to fail and blocking successful initialization in Docker or other deployment environments. The correct approach is to add a comma after evaluator_weighted_score Float64 and then list each INDEX clause as a separate, comma-delimited element—for example, INDEX idx_space_id space_id TYPE bloom_filter() GRANULARITY 1, ...—ensuring the script is parsed correctly and the table is created successfully. It is recommended that the project maintainers fix this syntax issue promptly to enable smooth onboarding for new users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions