/* adas风险表 */
CREATE TABLE risk (
    id String,
    warning_time DateTime64 CODEC(DoubleDelta),
    number SimpleAggregateFunction(max, LowCardinality(String)),
    vehicle_id SimpleAggregateFunction(max, LowCardinality(String)),
    brand SimpleAggregateFunction(max, LowCardinality(String)),
    plate_color SimpleAggregateFunction(max, Int8),
    level SimpleAggregateFunction(max, Int8),
    type SimpleAggregateFunction(max, LowCardinality(String)),
    status SimpleAggregateFunction(max, Int8),
    coordinate SimpleAggregateFunction(max, LowCardinality(String)),
    address SimpleAggregateFunction(max, LowCardinality(String)),
    speed SimpleAggregateFunction(max, Float64),
    deal_id SimpleAggregateFunction(max, LowCardinality(String)),
    driver_id SimpleAggregateFunction(max, LowCardinality(String)),
    job SimpleAggregateFunction(max, LowCardinality(String)),
    file_time SimpleAggregateFunction(max, Int64),
    deal_time SimpleAggregateFunction(max, Int64),
    result SimpleAggregateFunction(max, Int8),
    visit1 SimpleAggregateFunction(max, LowCardinality(String)),
    visit2 SimpleAggregateFunction(max, LowCardinality(String)),
    visit3 SimpleAggregateFunction(max, LowCardinality(String)),
    visit4 SimpleAggregateFunction(max, LowCardinality(String)),
    last_visit_time SimpleAggregateFunction(max, Int64),
    driver_names SimpleAggregateFunction(max, LowCardinality(String)),
    create_time SimpleAggregateFunction(max, Int64),
    create_user SimpleAggregateFunction(max, LowCardinality(String)),
    update_time SimpleAggregateFunction(max, Int64),
    update_user SimpleAggregateFunction(max, LowCardinality(String)),
    visit_times SimpleAggregateFunction(max, Int8),
    media_name SimpleAggregateFunction(max, LowCardinality(String)),
    media_url SimpleAggregateFunction(max, LowCardinality(String)),
    device_number SimpleAggregateFunction(max, LowCardinality(String)),
    video_flag SimpleAggregateFunction(max, Int8),
    pic_flag SimpleAggregateFunction(max, Int8),
    weather SimpleAggregateFunction(max, LowCardinality(String)),
    oversee_status SimpleAggregateFunction(max, Int8),
    transportation SimpleAggregateFunction(max, Int8),
    certification_code SimpleAggregateFunction(max, LowCardinality(String)),
    deal_dead_time SimpleAggregateFunction(max, Int64),
    accuracy SimpleAggregateFunction(max, Int8),
    driver_status SimpleAggregateFunction(max, Int8),
    intervention SimpleAggregateFunction(max, Int8),
    cooperation SimpleAggregateFunction(max, Int8),
    warn_status SimpleAggregateFunction(max, Int8),
    other SimpleAggregateFunction(max, LowCardinality(String)),
    handle_type SimpleAggregateFunction(max, LowCardinality(String)),
    is_remind_driver SimpleAggregateFunction(max, LowCardinality(String)),
    business_scope SimpleAggregateFunction(max, LowCardinality(String)),
    deal_people_id SimpleAggregateFunction(max, LowCardinality(String)),
    deal_org_id SimpleAggregateFunction(max, LowCardinality(String)),
    deal_org_name SimpleAggregateFunction(max, LowCardinality(String))
)
engine AggregatingMergeTree()
order by (id,warning_time)
partition by toDate(warning_time)
PRIMARY KEY(id,warning_time);
