Flink SQL实时计算案例三

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.table.api.EnvironmentSettings;
import org.apache.flink.table.api.Table;
import org.apache.flink.table.api.java.StreamTableEnvironment;
import org.apache.flink.types.Row;

/**
 * @description 电商场景实战之实时PV和UV曲线
 * @author: ZhiWen
 * @create: 2020-06-01 15:23
 **/
public class MainAppPvUv {
   
   //todo 已实现 时间函数应用
    /** 数据库RDS结果表
字段名	        数据类型	详情
summary_date	BIGINT	    统计日期。
summary_min	V   ARCHAR	    统计分钟。
pv	            BIGINT	    单击量。
uv	            BIGINT	    访客量。
currenttime	    TIMESTAMP	当前时间。*/


    public static final String KAFKA_SOURCE_SQL = "CREATE TABLE source_ods_fact_log_track_action (\n" +
            "  account_id VARCHAR,\n" +
            "  --用户ID\n" +
            "  client_ip VARCHAR,\n" +
            "  --客户端IP\n" +
            "  client_info VARCHAR,\n" +
            "  --设备机型信息\n" +
            "  `action` VARCHAR,\n" +
            "  --页面跳转描述\n" +
            "  gpm VARCHAR,\n" +
            "  --埋点链路\n" +
            "  c_time BIGINT,\n" +
            "  --请求时间\n" +
            "  udata VARCHAR,\n" +
            "  --扩展信息,JSON格式\n" +
            "  `position` VARCHAR,\n" +
            "  --位置信息\n" +
            "  network VARCHAR,\n" +
            "  --网络使用情况\n" +
            "  p_dt VARCHAR\n" +
            "  --时间分区天\n" +
            ") WITH (\n" +
            "\t'connector.type' = 'kafka',\n" +
            "\t'connector.version' = 'universal',\n" +
            "\t'connector.topic' = 'topic_uv',\n" +
            "\t'update-mode' = 'append',\n" +
            "\t'connector.properties.zookeeper.connect' = '172.24.103.8:2181',\n" +
            "\t'connector.properties.bootstrap.servers' = '172.24.103.8:9092',\n" +
            "\t'connector.startup-mode' = 'latest-offset',\n" +
            "\t'format.type' = 'json'\n" +
            ")";
    public static final String MYSQL_SINK_SQL = "CREATE TABLE result_cps_total_summary_pvuv_min (\n" +
            "  summary_date varchar,\n" +
            "  --统计日期\n" +
            "  summary_min varchar,\n" +
            "  --统计分钟\n" +
            "  pv bigint,\n" +
            "  --点击量\n" +
            "  uv bigint,\n" +
            "  --一天内同个访客多次访问仅计算一
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值