Hi 之前社区发过一个 JD 的解决方案,可以参考下[1]。 [1]: https://mp.weixin.qq.com/s/YluIj3vmebFmZjRbymKBZw
黄志高 <huangzhigao...@163.com> 于2021年8月16日周一 上午11:04写道: > == Physical Execution Plan == > > Stage 1 : Data Source > > content : Source: TableSourceScan(table=[[default_catalog, > default_database, test_kafka]], fields=[tz]) > > > > > Stage 2 : Operator > > content : Calc(select=[tt1(tz) AS tz], where=[tt1(tz) IS NOT NULL]) > > ship_strategy : FORWARD > > > > 从执行计划中看出,在select与where中这个tt1(tz)的udf确实调用了两次,看issuse,目前还没有被分配,是否有什么办法可以规避 > > > > > > > > > > > > > > > > > > 在 2021-08-16 09:47:28,"Qishang" <zhongqish...@gmail.com> 写道: > >Hi. > > > >应该是这个问题,https://issues.apache.org/jira/browse/FLINK-21573 > > > >打印一下执行计划和code gen > > > > > >黄志高 <huangzhigao...@163.com> 于2021年8月15日周日 下午10:06写道: > > > >> hi all, > >> 各位大佬,有没有遇到过eval方法被调用两次问题,在我使用select * from (select tt1(tz) from > >> test_kafka) as t where tz is not null > >> 时,在eval方法进行入参打印时,发现eval方法被调用了两次,当我使用select * from (select tt1(tz) from > >> test_kafka) as t这个sql时,不进行where tz is not null > 操作,eval方法此时只会调用一次,如果将where > >> tz is not null 改成 where tz ='某一个具体值'此时eval方法也只会调用一次,一开始我以为是is not null > >> 问题,我进行重写is not null方法,发现eval方法还是调用两次,不过此时发现eval方法是在select tt1(tz) from > >> test_kafka这个阶段发生一次,第二次是在where tz is not > >> > null执行后发生,虽然最后输出的结果不是双份,但是我认为eval方法执行两次,对效率有一定的影响,以下附件是我的代码截图,望各位大佬帮忙分析下,flink版本1.12 > >> > >> > >> > >> > >> >