Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache pig 在Pig中使用公共字段连接多个关系,不提供任何输出_Apache Pig - Fatal编程技术网

Apache pig 在Pig中使用公共字段连接多个关系,不提供任何输出

Apache pig 在Pig中使用公共字段连接多个关系,不提供任何输出,apache-pig,Apache Pig,我有两个关系r1和r2 grunt>describe r1; r1: {f1: chararray,ts: chararray} grunt>describe r2; r2: {f2:chararray,ts: chararray} 我想把ts上的两个关系连接起来,得到这样的输出 (f1,f2) 是我尝试过的(没有找到与我的案例相关的评论) 我在dump O上没有得到任何输出。我是pig的新手,请解释。这里是我使用的数据: 数据1 数据2 如果运行以下脚本,它将生成预期结果:

我有两个关系r1和r2

grunt>describe r1;
r1: {f1: chararray,ts: chararray}

grunt>describe r2;
r2: {f2:chararray,ts: chararray}
我想把ts上的两个关系连接起来,得到这样的输出

(f1,f2)
是我尝试过的(没有找到与我的案例相关的评论)


我在dump O上没有得到任何输出。我是pig的新手,请解释。

这里是我使用的数据:

数据1

数据2

如果运行以下脚本,它将生成预期结果:

 grunt> a = LOAD 'data1' as (f1:chararray, ts:int);
 grunt> b = LOAD 'data2' as (f2:chararray, ts:int);

 grunt> c = JOIN a BY ts, b BY ts;
 grunt> DESCRIBE c;
 c: {a::f1: chararray,a::ts: int,b::f2: chararray,b::ts: int}

 grunt> d = FOREACH c GENERATE CONCAT(f1, f2);
 grunt> DUMP d
 (f1af2a)
 (f1bf2c)

我很抱歉打错了。我编辑了我的解决方案,并给出了一个完整的工作示例。
 f1a    10
 f1b    12
 f2a    10
 f2b    11
 f2c    12
 grunt> a = LOAD 'data1' as (f1:chararray, ts:int);
 grunt> b = LOAD 'data2' as (f2:chararray, ts:int);

 grunt> c = JOIN a BY ts, b BY ts;
 grunt> DESCRIBE c;
 c: {a::f1: chararray,a::ts: int,b::f2: chararray,b::ts: int}

 grunt> d = FOREACH c GENERATE CONCAT(f1, f2);
 grunt> DUMP d
 (f1af2a)
 (f1bf2c)