Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8077429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:28:21+00:00 2026-06-05T15:28:21+00:00

I am a Hadoop/PIG beginner. Could anyone please tell me the difference between grunt>

  • 0

I am a Hadoop/PIG beginner.

Could anyone please tell me the difference between

grunt> A = join A by $1, B by $1 using 'merge';     

And
grunt> A = join A by $1, B by $1;

I have 2 files 1.txt and 2.txt which have the following data
1.txt
A 1
B 3
C 5
D 7

2.txt
AA 1
BB 2
CC 4
DD 6

And I want the output merged together like this
A 1
AA 1
BB 2
B 3
CC 4
C 5
DD 6
D 7

Will “using ‘merge'” give me the desired output?

I tried, however it is not.

Can you let me know what am I missing here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:28:22+00:00Added an answer on June 5, 2026 at 3:28 pm

    Sounds like you are getting an inner join (datasets joined by a common key) rather than an outer join (which is what it looks like you are after from your desired output).

    Use the word keyword FULL to signify you want a full outer join:

    grunt> A = join A by $1 FULL, B by $1 using 'merge';  
    

    This may however yield unexpected results if you have a record in both datasets with the same $0 (see the example for inner join). You may also need to amend the output to drop the missing columns between the two datasets.

    Alternatively, if you just want to append one dataset to another, and then sort, use the UNION and ORDER BY operators

    grunt> U = UNION A, B;
    grunt> OrderedU = ORDER U BY $1
    

    See

    • http://pig.apache.org/docs/r0.9.2/basic.html#join-inner
    • http://pig.apache.org/docs/r0.9.2/basic.html#join-outer
    • http://pig.apache.org/docs/r0.9.2/basic.html#order-by

    for more information about each

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apache Pig can load data from Hadoop sequence files using the PiggyBank SequenceFileLoader :
(Even more basic than Difference between Pig and Hive? Why have both? ) I
I am new to Hadoop/PIG. I have a basic question. Do we have a
I am trying to implement cross join using hadoop in java. Both sides of
I have a script (it's a hadoop pig script to b precice) from which
We have a cluster (hadoop, pig) which churns data 350Gb (growing couple of GB
In hadoop filesystem, I have two files say X and Y. Normally, hadoop makes
I am trying to write a Java program or Hadoop Pig script which will
I am new to pig script, Hadoop, Hbase. Here's what i need to know.
All Hadoop jobs have unique jobid. You can use jobid to get job status

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.