【Flink】The return type of function ‘Custom Source‘ could not be determined automatically

在使用Flink时遇到一个错误,`InvalidTypesException`指出自定义Source函数的返回类型无法自动确定。由于类型擦除,需要通过`returns(...)`方法或实现`ResultTypeQueryable`接口来提供类型信息。问题起因是自定义数据源的泛型返回类型Flink无法识别。解决方案包括在自定义数据源类中添加泛型或者明确指定返回类型。经过修改,问题得到了解决。
摘要由CSDN通过智能技术生成

在定义Flink数据源的时候出现了下面的错误

Exception in thread "main" org.apache.flink.api.common.functions.InvalidTypesException: The return type of function 'Custom Source' could not be determined automatically, due to type erasure. You can give type information hints by using the returns(...) method on the result of the transformation call, or by letting your function implement the 'ResultTypeQueryable' interface.
    at org.apache.flink.api.dag.Transformation.getOutputType(Transformation.java:479)
    at org.apache.flink.streaming.api.datastream.DataStream.addSink(DataStream.java:1236)
    at org.apache.flink.streaming.api.datastream.DataStream.print(DataStream.java:970)
    at com.demo.StateTest.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一杯咖啡半杯糖

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值