<?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 Re: Pig Incompatable schema in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133944#M55992</link>
    <description>&lt;P&gt;Thanks for input.what is the problem with my relation C.&lt;/P&gt;&lt;P&gt;STRSPLIT will generate tuple as output.Here it will consists of two fields in a tuple.&lt;/P&gt;&lt;P&gt;(a1:chararray, a1of1:chararray) is also a tuple since it is enclosed in parentheses and also consists of two fields&lt;/P&gt;</description>
    <pubDate>Fri, 03 Mar 2017 16:48:33 GMT</pubDate>
    <dc:creator>vamsi123</dc:creator>
    <dc:date>2017-03-03T16:48:33Z</dc:date>
    <item>
      <title>Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133942#M55990</link>
      <description>&lt;P&gt;my input file is below&lt;/P&gt;&lt;PRE&gt;a.txt

aaa.kyl,data,data
bbb.kkk,data,data
cccccc.hj,data,data
qa.dff,data,data
&lt;/PRE&gt;&lt;P&gt;A = LOAD '/pigdata/a.txt' USING PigStorage(',') AS(a1:chararray,a2:chararray,a3:chararray);&lt;/P&gt;&lt;P&gt;How to resolve below error and what is the reason  for this error&lt;/P&gt;&lt;PRE&gt;ERROR:-
C = FOREACH A GENERATE STRSPLIT(a1,'\\u002E') as (a1:chararray, a1of1:chararray),a2,a3;
2017-02-03 00:45:42,803 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1031: Incompatable schema: left is "a1:chararray,a1of1:chararray", right is ":tuple()"
&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Mar 2017 22:23:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133942#M55990</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2017-03-02T22:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133943#M55991</link>
      <description>&lt;P&gt;You need to flatten the STRSPLIT before you can project.&lt;/P&gt;&lt;PRE&gt;C = FOREACH A GENERATE FLATTEN(STRSPLIT(a1,'\\u002E')) as (a1:chararray, a1of1:chararray),a2,a3;   
&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Mar 2017 00:19:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133943#M55991</guid>
      <dc:creator>adnanalvee</dc:creator>
      <dc:date>2017-03-03T00:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133944#M55992</link>
      <description>&lt;P&gt;Thanks for input.what is the problem with my relation C.&lt;/P&gt;&lt;P&gt;STRSPLIT will generate tuple as output.Here it will consists of two fields in a tuple.&lt;/P&gt;&lt;P&gt;(a1:chararray, a1of1:chararray) is also a tuple since it is enclosed in parentheses and also consists of two fields&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2017 16:48:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133944#M55992</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2017-03-03T16:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133945#M55993</link>
      <description>&lt;P&gt;Any input on my clarification&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2017 08:57:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133945#M55993</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2017-03-04T08:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133946#M55994</link>
      <description>&lt;P&gt;The output of STRSPLIT is a tuple, so if you want to provide its schema you need to explicitly say for example "t1:tuple", like below, and after that you can refer to it as t1.a1 and t1.a1of1. With FLATTEN you get rid of the tuple. So you can choose which way to declare it.&lt;/P&gt;&lt;PRE&gt;grunt&amp;gt; b = FOREACH a generate STRSPLIT(a1,'\\u002E') as (t1:tuple(a1:chararray,a1of1:chararray)), a2, a3;
grunt&amp;gt; describe b; 
b: {t1: (a1: chararray,a1of1: chararray),a2: chararray,a3: chararray}
grunt&amp;gt; c = foreach b generate t1.a1, a3;&lt;/PRE&gt;</description>
      <pubDate>Sat, 04 Mar 2017 12:22:21 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133946#M55994</guid>
      <dc:creator>pminovic</dc:creator>
      <dc:date>2017-03-04T12:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133947#M55995</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/9789/vamsivalivetiedu.html" nodeid="9789"&gt;@vamsi valiveti
&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I noticed that you ask a lot of questions but haven't accepted many answers in the last few months. So, if you don't mind let me tell you a few words how this work: Both questions and answers can be up-voted if the others find them  helpful. Also, for each question one answer can be "accepted", usually by the user who asked the question, if that answer resolved the question or greatly helped the user to resolve the issue by himself. Accepted answers help HCC to better manage answered questions, and also help the others who search and find that question later to know that the accepted answer indeed works and can be trusted. So, it will be great if you accept one answer to this question, and some other questions you recently asked. Many thanks!
&lt;A rel="user" href="https://community.cloudera.com/users/9789/vamsivalivetiedu.html" nodeid="9789"&gt;&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 08:58:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133947#M55995</guid>
      <dc:creator>pminovic</dc:creator>
      <dc:date>2017-03-05T08:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133948#M55996</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;A rel="user" href="https://community.cloudera.com/users/9789/vamsivalivetiedu.html" nodeid="9789"&gt;@vamsi valiveti&lt;/A&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The result of the code you wrote gives the schema tike this 
&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt;&lt;EM&gt;((a1),(a1of1)),(a2),(a3)
&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Now your projection wouldn't work in a data schema like this as Pig still considers the first two rows which is 
&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"((a1),(a1of1))" as one. You need to use flatten for this case to make it into two separate columns. &lt;/EM&gt; &lt;/P&gt;&lt;P&gt;&lt;EM&gt;Thats exactly what my code is doing. I tested your data using my code. works perfectly. &lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 05:49:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133948#M55996</guid>
      <dc:creator>adnanalvee</dc:creator>
      <dc:date>2017-03-07T05:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Pig Incompatable schema</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133949#M55997</link>
      <description>&lt;P&gt;Thanks for comments.I will do it definately starting from this post.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 16:37:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Pig-Incompatable-schema/m-p/133949#M55997</guid>
      <dc:creator>vamsi123</dc:creator>
      <dc:date>2017-03-07T16:37:39Z</dc:date>
    </item>
  </channel>
</rss>

