create table central.tb_event
(
    `$product_id` String                            default '',
    `$type`       String                            default '',
    `$event`      String                            default '',
    `$time`       Int64                             default 0,
    `$flush_time` Int64                             default 0,
    `$package_name` Nullable(String)                default '',
    `$app_platform` Nullable(Int64)                 default 0,
    `$channel_name` Nullable(String)                default '',
    `$app_version_name` Nullable(String)            default '',
    `$app_version_code` Nullable(String)            default '',
    `$oaid` Nullable(String)                        default '',
    `$aaid` Nullable(String)                        default '',
    `$android_id` Nullable(String)                  default '',
    `$idfa` Nullable(String)                        default '',
    `$imei` Nullable(String)                        default '',
    `$idfv` Nullable(String)                        default '',
    `$machine_id` Nullable(String)                  default '',
    `$device_id`  String                            default '',
    `$ssid` Nullable(String)                        default '',
    `$reg_time` Nullable(DateTime('Asia/Shanghai')) default now(),
    `$brand` Nullable(String)                       default '',
    `$model` Nullable(String)                       default '',
    `$os_version` Nullable(String)                  default '',
    `$ip` Nullable(String)                          default '',
    `$city` Nullable(String)                        default '',
    `$country` Nullable(String)                     default '',
    `$app_used_time` Nullable(Int64)                default 0,
    `$payment_amount` Nullable(Int64)               default 0,
    `$payment_currency` Nullable(String)            default '',
    `$payment_method` Nullable(String)              default '',
    `$payment_item_name` Nullable(String)           default '',
    `$page_name` Nullable(String)                   default '',
    `$page_used_time` Nullable(Int64)               default 0,
    `$payment_order_no` Nullable(String)            default '',
    `$session_id` Nullable(String)                  default '',
    `id` Nullable(String)                           default ''
)
    engine = ReplacingMergeTree
        PARTITION BY toYYYYMM(fromUnixTimestamp64Milli(`$time`))
        ORDER BY (`$product_id`, `$type`, `$event`, `$device_id`, `$time`)
        SETTINGS index_granularity = 8192;

