CREATE TABLE IF NOT EXISTS connector_events
(
    sessionid                          UInt64,
    connectioninformation_downlink     Nullable(UInt64),
    connectioninformation_type         Nullable(String),
    consolelog_level                   Nullable(String),
    consolelog_value                   Nullable(String),
    customevent_messageid              Nullable(UInt64),
    customevent_name                   Nullable(String),
    customevent_payload                Nullable(String),
    customevent_timestamp              Nullable(UInt64),
    errorevent_message                 Nullable(String),
    errorevent_messageid               Nullable(UInt64),
    errorevent_name                    Nullable(String),
    errorevent_payload                 Nullable(String),
    errorevent_source                  Nullable(String),
    errorevent_timestamp               Nullable(UInt64),
    jsexception_message                Nullable(String),
    jsexception_name                   Nullable(String),
    jsexception_payload                Nullable(String),
    metadata_key                       Nullable(String),
    metadata_value                     Nullable(String),
    mouseclick_id                      Nullable(UInt64),
    mouseclick_hesitationtime          Nullable(UInt64),
    mouseclick_label                   Nullable(String),
    pageevent_firstcontentfulpaint     Nullable(UInt64),
    pageevent_firstpaint               Nullable(UInt64),
    pageevent_messageid                Nullable(UInt64),
    pageevent_referrer                 Nullable(String),
    pageevent_speedindex               Nullable(UInt64),
    pageevent_timestamp                Nullable(UInt64),
    pageevent_url                      Nullable(String),
    pagerendertiming_timetointeractive Nullable(UInt64),
    pagerendertiming_visuallycomplete  Nullable(UInt64),
    rawcustomevent_name                Nullable(String),
    rawcustomevent_payload             Nullable(String),
    setviewportsize_height             Nullable(UInt64),
    setviewportsize_width              Nullable(UInt64),
    timestamp_timestamp                Nullable(UInt64),
    user_anonymous_id                  Nullable(String),
    user_id                            Nullable(String),
    issueevent_messageid               Nullable(UInt64),
    issueevent_timestamp               Nullable(UInt64),
    issueevent_type                    Nullable(String),
    issueevent_contextstring           Nullable(String),
    issueevent_context                 Nullable(String),
    issueevent_payload                 Nullable(String),
    customissue_name                   Nullable(String),
    customissue_payload                Nullable(String),
    received_at                        UInt64,
    batch_order_number                 UInt64
) ENGINE = MergeTree()
PARTITION BY intDiv(received_at, 100000)
ORDER BY (received_at, batch_order_number, sessionid)
PRIMARY KEY (received_at)
SETTINGS use_minimalistic_part_header_in_zookeeper=1, index_granularity=1000;