关于flink cdc sql转出Stream流问题

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

关于flink cdc sql转出Stream流问题

yujianbo
代码采用sql方式接入mysql cdc数据然后转出Stream流, 写入kudu,但是不知道怎么去获取
row里面的主键字段是哪一个和字段名称和类型等?
或者toRetractStream可以指定其他的class???

下面是代码
======================================
        tableEnv.executeSql(createTableSql);
        Table table = tableEnv.sqlQuery(querySql);
        DataStream<Tuple2&lt;Boolean, Row>> dataStream =
tableEnv.toRetractStream(table, Row.class);
        dataStream.print().setParallelism(1);
======================================



--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: 关于flink cdc sql转出Stream流问题

jsqf
可以使用这种方式:
DataStream<RowData> dstream = tableEnv.toAppendStream(sourceTable,
RowData.class);



--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: 关于flink cdc sql转出Stream流问题

Jark
Administrator
row 里面的数据就是你 schema 中定义的字段和顺序,可以按下标取值。

On Tue, 1 Dec 2020 at 13:59, jsqf <[hidden email]> wrote:

> 可以使用这种方式:
> DataStream<RowData> dstream = tableEnv.toAppendStream(sourceTable,
> RowData.class);
>
>
>
> --
> Sent from: http://apache-flink.147419.n8.nabble.com/
>