/* 报警转发表 */
create table alarm_forward (
  time DateTime64 CODEC(DoubleDelta),
  msg_sn Int32,
  msg_id Int32,
  plat_id String,
  monitor_id SimpleAggregateFunction(max, LowCardinality(String)),
  monitor_name SimpleAggregateFunction(max, LowCardinality(String)),
  plate_color SimpleAggregateFunction(max, Int32),
  group_id SimpleAggregateFunction(max, LowCardinality(String)),
  alarm_type SimpleAggregateFunction(max, Int32),
  alarm_start_time SimpleAggregateFunction(max, Int64),
  risk_event_id SimpleAggregateFunction(max, LowCardinality(String)),
  protocol_type SimpleAggregateFunction(max, Int32),
  alarm_id SimpleAggregateFunction(max, LowCardinality(String))
)
engine AggregatingMergeTree()
order by (time, msg_sn, msg_id, plat_id)
partition by toDate(time)
PRIMARY KEY(time, msg_sn, msg_id, plat_id);

