create table shjy.event
(
    `#ip`                     Nullable(IPv4),
    `#country`                Nullable(String),
    `#country_code`           Nullable(String),
    `#province`               Nullable(String),
    `#city`                   Nullable(String),
    `#os_version`             Nullable(String),
    `#manufacturer`           Nullable(String),
    `#os`                     Nullable(String),
    `#device_id`              Nullable(String),
    `#screen_height`          Nullable(UInt16),
    `#screen_width`           Nullable(UInt16),
    `#device_model`           Nullable(String),
    `#app_version`            Nullable(String),
    `#bundle_id`              Nullable(String),
    `#lib`                    Nullable(String),
    `#lib_version`            Nullable(String),
    `#network_type`           Nullable(String),
    `#carrier`                Nullable(String),
    `#browser`                Nullable(String),
    `#browser_version`        Nullable(String),
    `#duration`               Nullable(String),
    `#url`                    Nullable(String),
    `#url_path`               Nullable(String),
    `#referrer`               Nullable(String),
    `#referrer_host`          Nullable(String),
    `#title`                  Nullable(String),
    `#screen_name`            Nullable(String),
    `#element_id`             Nullable(String),
    `#element_type`           Nullable(String),
    `#resume_from_background` Nullable(String),
    `#element_selector`       Nullable(String),
    `#element_position`       Nullable(String),
    `#element_content`        Nullable(String),
    `#scene`                  Nullable(String),
    `#mp_platform`            Nullable(String),
    `#app_crashed_reason`     Nullable(String),
    `#zone_offset`            Int8            default 8,
    `#event_id`               String,

    `#event_time`             DateTime('UTC'),
    `#account_id`             String,
    `#distinct_id`            Nullable(String),
    `#event_name`             String,
    `#server_time`            DateTime('UTC') default now(),


    `sign`                    Int8 default 1

) ENGINE = CollapsingMergeTree(sign)
      PARTITION BY toYYYYMMDD(`#event_time`)
      order by (`#account_id`, `#event_time`, `#event_name`)
--       TTL event_time + toIntervalDay(365)