<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169419#M131733</link>
    <description>&lt;P&gt;If I create a schema on load everything works fine.  However I did not want to create whole schema for a few fields out of 100's.   This script fails with &lt;/P&gt;&lt;P&gt;Unable to open iterator for alias A. Backend error : java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot be cast to java.math.BigInteger&lt;/P&gt;&lt;PRE&gt;H = LOAD '/user/horton/hands.txt' USING PigStorage(',');
FilteredHands = FILTER H BY (int)$10==6 AND (int)$5==6;
Hands = FOREACH H GENERATE $0 AS (HandID:biginteger), $5 AS (BigBet:double),  $10 AS (PlayersInHand:int); 
HP = LOAD '/user/horton/playerhands.txt' USING PigStorage(',');
HandPlayers = FOREACH HP GENERATE $1 AS (HandID:biginteger), $0 AS (PlayerName:chararray), $12 AS (AmtWon:double);
PlayersAndHands = JOIN Hands by HandID, HandPlayers by HandID;
A = FOREACH PlayersAndHands GENERATE  Hands.HandID;
DUMP A;&lt;/PRE&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
    <pubDate>Mon, 26 Sep 2016 15:34:46 GMT</pubDate>
    <dc:creator>andyblum</dc:creator>
    <dc:date>2016-09-26T15:34:46Z</dc:date>
    <item>
      <title>Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169419#M131733</link>
      <description>&lt;P&gt;If I create a schema on load everything works fine.  However I did not want to create whole schema for a few fields out of 100's.   This script fails with &lt;/P&gt;&lt;P&gt;Unable to open iterator for alias A. Backend error : java.lang.ClassCastException: org.apache.pig.data.DataByteArray cannot be cast to java.math.BigInteger&lt;/P&gt;&lt;PRE&gt;H = LOAD '/user/horton/hands.txt' USING PigStorage(',');
FilteredHands = FILTER H BY (int)$10==6 AND (int)$5==6;
Hands = FOREACH H GENERATE $0 AS (HandID:biginteger), $5 AS (BigBet:double),  $10 AS (PlayersInHand:int); 
HP = LOAD '/user/horton/playerhands.txt' USING PigStorage(',');
HandPlayers = FOREACH HP GENERATE $1 AS (HandID:biginteger), $0 AS (PlayerName:chararray), $12 AS (AmtWon:double);
PlayersAndHands = JOIN Hands by HandID, HandPlayers by HandID;
A = FOREACH PlayersAndHands GENERATE  Hands.HandID;
DUMP A;&lt;/PRE&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 15:34:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169419#M131733</guid>
      <dc:creator>andyblum</dc:creator>
      <dc:date>2016-09-26T15:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169420#M131734</link>
      <description>&lt;P&gt;I cannot dump PlaeyersAndHands either.  Both HandPlayers and Hands dump fine.  &lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 16:29:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169420#M131734</guid>
      <dc:creator>andyblum</dc:creator>
      <dc:date>2016-09-26T16:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169421#M131735</link>
      <description>&lt;P&gt;Replace biginteger datatype with bytearray.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 16:43:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169421#M131735</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-09-26T16:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169422#M131736</link>
      <description>&lt;P&gt;Thank you so much.  That worked.  Is biginteger uncastable?  When would I use bytearray vs.  specific type?  Interesting thing is if I LOAD with schema joins on biginteger works fine.  Would you consider this a bug?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 16:51:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169422#M131736</guid>
      <dc:creator>andyblum</dc:creator>
      <dc:date>2016-09-26T16:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Generating schema in  FOREACH and then join -  java.lang.ClassCastException: org.apache.pig.data.DataByteArray</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169423#M131737</link>
      <description>&lt;P&gt;can't tell without seeing your data. Can you try with schema join as well and confirm bytearray works in either condition.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Sep 2016 19:36:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Generating-schema-in-FOREACH-and-then-join-java-lang/m-p/169423#M131737</guid>
      <dc:creator>aervits</dc:creator>
      <dc:date>2016-09-26T19:36:59Z</dc:date>
    </item>
  </channel>
</rss>

