Talend中当前行,上一行和下一行之间的比较 [英] Comparison between current row, previous row and next row in Talend

查看:166
本文介绍了Talend中当前行,上一行和下一行之间的比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道我的值是否包含在由上一行和下一行组成的间隔中。如何在塔伦德做?

I want to know if my value is included in an interval consisting of the previous row and the next row. How to do it in Talend?

我尝试了 tMemorizeRow 函数,每次都保存3行,但是遇到了 java.lang.NullPointerException 异常,因为当我在第一行时它不知道我保存的下一行。

I tried a tMemorizeRow function where I save 3 lines each time, but encountered a java.lang.NullPointerException exception as when I am on the first line it does not know the next row I saved.

我缺少什么?

推荐答案

您可以尝试以下操作:添加一列序列,其值为 Numeric.sequence( s1,1,1)到您的数据:这样,您将知道流中各行之间的确切顺序(可以在tMap中完成)。将tMap重定向到tHashOutput组件(如果在调色板中找不到,则通过Project Parameters> Designer> Palette> Technique进行添加,默认情况下此组件为隐藏)。

You can try this : add a column "sequence" with value as Numeric.sequence("s1",1,1)to your data : this way you'll know this exact order between rows in your flow (you can do it in a tMap). Redirect the tMap to a tHashOutput component (if you can't find in the palette, add it through Project Parameters>Designer>Palette>Technique , this component is hidden by default).

然后,您将需要另一个子作业,其中有3个tHashInput:一个用于主流程,另外两个作为查找:由于序列,您可以将上一个和下一个行合并在一起。

Then you'll need an other subjob, with 3 tHashInput : one for your main flow, and the two others as lookup : then you'll be able to join rows with previous and following one , thanks to your 'sequence' field.

然后在tMap_2中,您就可以将mainFlow的值与上一个和下一个流进行比较。

Then in tMap_2 you'll be able to compare values from mainFlow with Previous and Next flows.

这篇关于Talend中当前行,上一行和下一行之间的比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆