Hi. 新版的 CatalogFactory 实现了 Factory,这意味着当前的所有的 connector、format 以及 Catalog 都实现了相同的接口,保持了统一性。而保持原来的方法,更多是为了暂时的兼容性( 我的理解 ): 如果 某个Catalog 从低版本迁移到高版本只需要添加一些新的接口方法,而不需要删除之前的逻辑。之后的版本可能会删除这些已经被deprecated 方法。
Best, Shengkai. hoose <[email protected]> 于2021年7月15日周四 下午6:13写道: > Flink1.13.1在Catalog方面修改比较大,特别是一些方法的实现上 > 如 > JdbcCatalogFactory implements CatalogFactory中: > 核心三个方法全部过期: > public Map<String, String> requiredContext() > public List<String> supportedProperties() > public Catalog createCatalog(String name, Map<String, String> > properties) > > > > 新的替换方法: > public Set<ConfigOption<?>> requiredOptions() > public Set<ConfigOption<?>> optionalOptions() > public Catalog createCatalog(Context context) > > > > 用新的方法打包之后运行: > Exception in thread "main" org.apache.flink.table.api.TableException: > Required context of factory > 'com.apache.flink.catalog.factory.MysqlCatalogFactory' must not be null > 跟踪代码进去发现, > private static Map<String, String> > normalizeContext(TableFactory factory) { > Map<String, String> requiredContext = > factory.requiredContext(); > if (requiredContext == null) { > throw new TableException( > > String.format( > > "Required context of factory '%s' must not be > null.", > } > factory.getClass().getName())); > > 看错误是因为requiredContext == > null了,其实就是上面requiredContext()没有实现,不明白新版api都把这个方法过期了,为啥在后面还要调用判断他? > > > 希望大佬们讲解一下
