【问题标题】:The type TableSchema.Builder is deprecated类型 TableSchema.Builder 已弃用
【发布时间】:2021-12-30 07:44:32
【问题描述】:

根据标题,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();

【问题讨论】:

    标签: java apache-flink


    【解决方案1】:

    这取决于您要声明什么架构:目录表、连接器、DataStream API 转换?

    以上所有位置都提供Schema 参数。作为用户,您通常只需要使用Schema。但是,Schema.Builder 提供了从来自框架的ResolvedSchema 继承组件的方法。

    【讨论】:

      猜你喜欢
      • 2012-12-25
      • 2013-10-12
      • 1970-01-01
      • 1970-01-01
      • 2023-02-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-28
      • 2019-11-28
      相关资源
      最近更新 更多