级联管道中的SQL NOT IN等效于什么? [英] What is the equivalent of SQL NOT IN in Cascading Pipes?

查看:162
本文介绍了级联管道中的SQL NOT IN等效于什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我如何在这里添加where条件?我有两个文件有一个公共字段,基于该字段值,我需要获得第二个文件值。



是否有其他PIPE可供使用?



File1:

  tcno,date,amt 
1234,3 / 10 / 2016,1000
1234,3 / 11 / 2016,400
23456,2 / 10 / 2016,1500

File2:

  cno,fname,lname,city,phone,mail 
1234,first,last ,city,1234556,123 @ 123.com

示例代码:

 管道1 =新管道(custPipe); 
Pipe pipe2 =新管道(tscnPipe);
字段cJoinField =新字段(cno);
字段tJoinField =新字段(tcno);
Pipe pipe = new HashJoin(pipe1,cJoinField,pipe2,tJoinField,new OuterJoin());
//如何添加条件,即CNO从第二个文件是NULL
字段outFields =新字段(tcno,tdate,tamt);

我期待输出作为第一个文件的最后一行[ 23456,2 / 10 / 2016,1500 ]

解决方案

根据代码中的评论:

  //如何添加条件(即CNO从第二个文件为NULL)

尝试使用 FilterNull



HashJoin step:

  FilterNull filterNull = new FilterNull(); 
pipe = new每个(pipe,cJoinField,filterNull);

类似于:

 管道1 =新管道(custPipe); 
Pipe pipe2 =新管道(tscnPipe);
字段cJoinField =新字段(cno);
字段tJoinField =新字段(tcno);
Pipe pipe = new HashJoin(pipe1,cJoinField,pipe2,tJoinField,new OuterJoin());

//过滤掉那些cno为空的元组
FilterNull filterNull = new FilterNull();
pipe = new每个(pipe,cJoinField,filterNull);

字段outFields =新字段(tcno,tdate,tamt);


I have two files with one common field, based on that field value i need to get the second file values.

How do i add the where Condition here?

Is there any other PIPE available for NOT IN use?

File1:

tcno,date,amt
1234,3/10/2016,1000
1234,3/11/2016,400
23456,2/10/2016,1500

File2:

cno,fname,lname,city,phone,mail
1234,first,last,city,1234556,123@123.com

Sample Code:

Pipe pipe1 = new Pipe("custPipe");
Pipe pipe2 = new Pipe("tscnPipe");
Fields cJoinField = new Fields("cno");
Fields tJoinField = new Fields("tcno");
Pipe pipe = new HashJoin(pipe1, cJoinField, pipe2, tJoinField,  new OuterJoin());
//HOW TO ADD WHERE CONDITION i.e. CNO IS NULL FROM SECOND FILE
Fields outFields = new Fields("tcno","tdate", "tamt");

I am expecting the output as first file last line [23456,2/10/2016,1500]

解决方案

Based on the comment in the code:

//HOW TO ADD WHERE CONDITION i.e. CNO IS NULL FROM SECOND FILE

Try using FilterNull.

Add the following line to you code after HashJoin step:

FilterNull filterNull = new FilterNull();
pipe = new Each( pipe, cJoinField, filterNull );

Something like:

Pipe pipe1 = new Pipe("custPipe");
Pipe pipe2 = new Pipe("tscnPipe");
Fields cJoinField = new Fields("cno");
Fields tJoinField = new Fields("tcno");
Pipe pipe = new HashJoin(pipe1, cJoinField, pipe2, tJoinField,  new OuterJoin());

// Filter out those tuples which has cno as null
FilterNull filterNull = new FilterNull();
pipe = new Each( pipe, cJoinField, filterNull );

Fields outFields = new Fields("tcno","tdate", "tamt");

这篇关于级联管道中的SQL NOT IN等效于什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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