BEGIN;

CREATE DYNAMIC TABLE ods.yinzhou_dynamic_demo2 (
    ds,
    id,
    name,
    device_cut,
    user_cut
)with (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '864000',
bitmap_columns = 'ds,name',
clustering_key = 'ds,id,name',
dictionary_encoding_columns = 'ds:auto,name:auto',
distribution_key = 'ds,id',
table_group = 'sdk_statis_test_tg_default',
table_storage_mode = 'hot',
time_to_live_in_seconds = '3153600000',
auto_refresh_enable='true',
incremental_auto_refresh_interval='2 minutes',
incremental_auto_refresh_schd_start_time='immediate',
incremental_guc_hg_computing_resource='local',
refresh_mode='incremental'
) AS SELECT
t1.ds,t2.ID,
  t2.NAME,
  UNIQ ( device_id ) device_cut,
  UNIQ ( user_id ) user_cut
FROM
  "ods_payment_order" t1
  INNER JOIN "public"."gm_apply"  FOR SYSTEM_TIME AS OF PROCTIME() t2
  ON t1.appid = t2."id"
GROUP BY
t1.ds,
  t2.ID,
  t2.NAME;




END;
