根据标题,类型TableSchema.Builder已弃用,VScode的建议是:This class has been deprecated as part of FLIP-164. It has been replaced by two more dedicated classes **Schema and ResolvedSchema**. Use Schema for declaration in APIs. ResolvedSchema is offered by the framework after resolution and validation.
我的问题是:如何用另外两个专用类Schema和ResolvedSchema替换tableSchema?
顺便说一下,我在网上搜索了很长时间。但是我什么也找不到。需要一些想法如何实现这一点,提前感谢。
TableSchema.Builder tableBuilder = new TableSchema.Builder().fields(names, types);
primaryKey.ifPresent(
pk -> tableBuilder.primaryKey(
pk.getName(), pk.getColumns().toArray(new String[0])));
TableSchema tableSchema = tableBuilder.build();
这取决于您想要声明架构的内容:目录表、连接器、DataStream API转换?
以上所有位置都提供Schema
参数。作为用户,您通常只需要使用Schema
。但是,Schema.Builder
提供了从框架中的ResolvedSchema
继承组件的方法。