栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

【Flink ERROR】List of column aliases must have same degree as table; the returned table of function ‘

【Flink ERROR】List of column aliases must have same degree as table; the returned table of function ‘

List of column aliases must have same degree as table; the returned table of function ‘split’ has 1 columns, whereas alias list has 2 columns

在自定义表函数时,运行出现了此错误,具体报错如下:

log4j:WARN No appenders could be found for logger (org.apache.flink.api.java.typeutils.TypeExtractor).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.apache.flink.table.api.ValidationException: List of column aliases must have same degree as table; the returned table of function 'split' has 1 columns, whereas alias list has 2 columns
	at org.apache.flink.table.operations.utils.factories.CalculatedTableFactory$FunctionTableCallVisitor.createFunctionCall(CalculatedTableFactory.java:116)
	at org.apache.flink.table.operations.utils.factories.CalculatedTableFactory$FunctionTableCallVisitor.unwrapFromAlias(CalculatedTableFactory.java:100)
	at org.apache.flink.table.operations.utils.factories.CalculatedTableFactory$FunctionTableCallVisitor.visit(CalculatedTableFactory.java:74)
	at org.apache.flink.table.operations.utils.factories.CalculatedTableFactory$FunctionTableCallVisitor.visit(CalculatedTableFactory.java:62)
	at org.apache.flink.table.expressions.Callexpression.accept(Callexpression.java:122)
	at org.apache.flink.table.operations.utils.factories.CalculatedTableFactory.create(CalculatedTableFactory.java:59)
	at org.apache.flink.table.operations.utils.OperationTreeBuilder.joinLateral(OperationTreeBuilder.java:367)
	at org.apache.flink.table.api.internal.TableImpl.joinLateralInternal(TableImpl.java:337)
	at org.apache.flink.table.api.internal.TableImpl.joinLateral(TableImpl.java:289)
	at org.apache.flink.table.api.internal.TableImpl.joinLateral(TableImpl.java:284)
	at udf.udfTest2_TableFunction.main(udfTest2_TableFunction.java:42)

原因:自定义类集成TableFunction时没有实现getResultType方法
如我们此时输出的是Row类型,我们就需要重写此方法

        @Override
        public TypeInformation getResultType() {
            return Types.ROW(Types.STRING, Types.INT);
        }
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/745160.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号