不好笑
不好笑

Reputation: 105

JOIN usages in PigLatin

I want to join two tables/alias, let says:

Table A (People_ID, People_Name)
Table B (Location, People_ID)

The following is my pig Latin input:

join_table = JOIN A BY People_ID, B BY People_ID

However when I enter:

describe join_table;

It show:

join_table:{A::people_id:int,A::people_name:chararray,B::people_id:int,B::location:chararray}

Is that normal? I thought the outcome should be like this:

join_table:{A::people_id:int,A::people_name:chararray,B::location:chararray}

Upvotes: 0

Views: 37

Answers (1)

Rijul
Rijul

Reputation: 1445

yes the output is normal, for your desired output you have to GENERATE your JOINED relation in another relation.

try this:

join_table = JOIN A BY People_ID, B BY People_ID

generate_joined_table = FOREACH join_table GENERATE 
A::people_id AS people_id,A::people_name AS people_name,B::location AS location;

DESCRIBE generate_joined_table;

Upvotes: 1

Related Questions