试了几个表都这样, 需求: 表数据按照公司id分组计数,
注册表语句:
“CREATE TABLE jsk_staff_combine_online (\
” +
" staff_id
STRING,\
" +
" company_id
INT,\
" +
" num_project
INT,\
" +
" PRIMARY KEY(staff_id) NOT ENFORCED\
" +
“) WITH (\
” +
" ‘connector’ = ‘tidb-cdc’,\
" +
" ‘tikv.grpc.timeout_in_ms’ = ‘120000’,\
" +
" ‘pd-addresses’ = ‘"+hostName+":2379’,\
" +
" ‘jdbc.properties.useSSL’ = ‘false’,\
" +
" ‘jdbc.properties.useUnicode’ = ‘true’,\
" +
" ‘jdbc.properties.characterEncoding’ = ‘UTF-8’,\
" +
" ‘jdbc.properties.allowMultiQueries’ = ‘true’,\
" +
" ‘database-name’ = ‘jsk_data’,\
" +
" ‘table-name’ = ‘jsk_staff_combine_online’\
" +
“)”
插入语句:
insert into jsk_dws_count_professional(company_id,team_leader) select company_id,count(*) as cnt from jsk_staff_combine_online where num_project > 0 group by company_id
然后我索性试了2个表之前的同步,上面的jsk_staff_combine_online 这个表同步到 test表中, 结果也是一样,只同步了100w+数据, 也只有一个source的task有数据
插入语句:
insert into test_jsk_staff_combine_online(staff_id,company_id,num_project) select staff_id,company_id,num_project from jsk_staff_combine_online