CREATE TABLE IF NOT EXISTS dws_chat_assistant_day
(
    `stat_date` Date,
    `dimension_id` UInt64,
    `session_count` UInt64,
    `message_count` UInt64
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(stat_date)
ORDER BY (stat_date, dimension_id);

CREATE TABLE IF NOT EXISTS dws_chat_user_day
(
    `stat_date` Date,
    `dimension_id` UInt64,
    `session_count` UInt64,
    `message_count` UInt64
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(stat_date)
ORDER BY (stat_date, dimension_id);

CREATE TABLE IF NOT EXISTS dws_chat_session_day
(
    `stat_date` Date,
    `dimension_id` UInt64,
    `assistant_id` UInt64,
    `user_id` UInt64,
    `message_count` UInt64
)
ENGINE = MergeTree
PARTITION BY toYYYYMM(stat_date)
ORDER BY (stat_date, dimension_id);
