Pig null data frame is generating data when used inside 'foreach' clause










1















Pardon me if I am using wrong standard pig names as I am new to it.



I have 2 dataframes in Pig (X and Y). Both having variables: j1 and j2.
I am doing below operations:



A = JOIN X by (j1) left outer, Y by (j1);

SPLIT A into B (IF Y::j1 IS NULL), C otherwise;

D = FOREACH B GENERATE X::j2;


Here, if we do DUMP B then there is no data inside it.
If we do DUMP C then data d1 appears.
But when I do DUMP D then the same data d1 appears, which is wired because B did not have any data points.



Can someone tell why it is happening?



NOTE: I have tried:



  1. Storing B and then looking manually into part files but nothing is there in B.


  2. I have also Stored A, then came out of session and then started the session in grunt and Loaded A and then executed last 2 lines of the code (i.e split and foreach). And when I am doing this then the code is working as expected and DUMP D is not showing any output data (which is correct).


FOUND THE SOLUTION:
It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y. Basically Jar was not able to read the csv file properly which is creating issue in join operation above.










share|improve this question
























  • Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

    – Rajeev Atmakuri
    Nov 9 '18 at 8:00











  • Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

    – Bhuvi007
    Nov 9 '18 at 8:28












  • Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

    – Koji
    Nov 21 '18 at 18:01











  • Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

    – Bhuvi007
    Nov 22 '18 at 6:25















1















Pardon me if I am using wrong standard pig names as I am new to it.



I have 2 dataframes in Pig (X and Y). Both having variables: j1 and j2.
I am doing below operations:



A = JOIN X by (j1) left outer, Y by (j1);

SPLIT A into B (IF Y::j1 IS NULL), C otherwise;

D = FOREACH B GENERATE X::j2;


Here, if we do DUMP B then there is no data inside it.
If we do DUMP C then data d1 appears.
But when I do DUMP D then the same data d1 appears, which is wired because B did not have any data points.



Can someone tell why it is happening?



NOTE: I have tried:



  1. Storing B and then looking manually into part files but nothing is there in B.


  2. I have also Stored A, then came out of session and then started the session in grunt and Loaded A and then executed last 2 lines of the code (i.e split and foreach). And when I am doing this then the code is working as expected and DUMP D is not showing any output data (which is correct).


FOUND THE SOLUTION:
It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y. Basically Jar was not able to read the csv file properly which is creating issue in join operation above.










share|improve this question
























  • Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

    – Rajeev Atmakuri
    Nov 9 '18 at 8:00











  • Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

    – Bhuvi007
    Nov 9 '18 at 8:28












  • Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

    – Koji
    Nov 21 '18 at 18:01











  • Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

    – Bhuvi007
    Nov 22 '18 at 6:25













1












1








1








Pardon me if I am using wrong standard pig names as I am new to it.



I have 2 dataframes in Pig (X and Y). Both having variables: j1 and j2.
I am doing below operations:



A = JOIN X by (j1) left outer, Y by (j1);

SPLIT A into B (IF Y::j1 IS NULL), C otherwise;

D = FOREACH B GENERATE X::j2;


Here, if we do DUMP B then there is no data inside it.
If we do DUMP C then data d1 appears.
But when I do DUMP D then the same data d1 appears, which is wired because B did not have any data points.



Can someone tell why it is happening?



NOTE: I have tried:



  1. Storing B and then looking manually into part files but nothing is there in B.


  2. I have also Stored A, then came out of session and then started the session in grunt and Loaded A and then executed last 2 lines of the code (i.e split and foreach). And when I am doing this then the code is working as expected and DUMP D is not showing any output data (which is correct).


FOUND THE SOLUTION:
It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y. Basically Jar was not able to read the csv file properly which is creating issue in join operation above.










share|improve this question
















Pardon me if I am using wrong standard pig names as I am new to it.



I have 2 dataframes in Pig (X and Y). Both having variables: j1 and j2.
I am doing below operations:



A = JOIN X by (j1) left outer, Y by (j1);

SPLIT A into B (IF Y::j1 IS NULL), C otherwise;

D = FOREACH B GENERATE X::j2;


Here, if we do DUMP B then there is no data inside it.
If we do DUMP C then data d1 appears.
But when I do DUMP D then the same data d1 appears, which is wired because B did not have any data points.



Can someone tell why it is happening?



NOTE: I have tried:



  1. Storing B and then looking manually into part files but nothing is there in B.


  2. I have also Stored A, then came out of session and then started the session in grunt and Loaded A and then executed last 2 lines of the code (i.e split and foreach). And when I am doing this then the code is working as expected and DUMP D is not showing any output data (which is correct).


FOUND THE SOLUTION:
It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y. Basically Jar was not able to read the csv file properly which is creating issue in join operation above.







bigdata apache-pig apache-pig-grunt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 6:27







Bhuvi007

















asked Nov 9 '18 at 5:32









Bhuvi007Bhuvi007

176




176












  • Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

    – Rajeev Atmakuri
    Nov 9 '18 at 8:00











  • Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

    – Bhuvi007
    Nov 9 '18 at 8:28












  • Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

    – Koji
    Nov 21 '18 at 18:01











  • Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

    – Bhuvi007
    Nov 22 '18 at 6:25

















  • Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

    – Rajeev Atmakuri
    Nov 9 '18 at 8:00











  • Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

    – Bhuvi007
    Nov 9 '18 at 8:28












  • Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

    – Koji
    Nov 21 '18 at 18:01











  • Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

    – Bhuvi007
    Nov 22 '18 at 6:25
















Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

– Rajeev Atmakuri
Nov 9 '18 at 8:00





Are you sure that your second statement runs without error? You need to tell Pig which j1 you are referring to: X::j1 or Y::j1. The decision might result in B having or not having data due to the left outer join. While adding DUMP statements are you sure that none of your other statements are changing?

– Rajeev Atmakuri
Nov 9 '18 at 8:00













Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

– Bhuvi007
Nov 9 '18 at 8:28






Hi, apologies for the typo. I have added Y::j1 in the code. And now the code is exactly same with no changes at all. So no other statements are changing while dumping.

– Bhuvi007
Nov 9 '18 at 8:28














Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

– Koji
Nov 21 '18 at 18:01





Can you share a sample input, expected output and actual output? It's not clear to me what "d1" is referring to (since your script does not have any "d1".)

– Koji
Nov 21 '18 at 18:01













Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

– Bhuvi007
Nov 22 '18 at 6:25





Hi, the issue is resolved. It was not actually the Pig issue. It was Jar issue which I was using to read data and hence creating data frames X and Y.

– Bhuvi007
Nov 22 '18 at 6:25












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53220375%2fpig-null-data-frame-is-generating-data-when-used-inside-foreach-clause%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53220375%2fpig-null-data-frame-is-generating-data-when-used-inside-foreach-clause%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto