<?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: Python HIVE UDF (Import os) module missing in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30868#M7015</link>
    <description>&lt;P&gt;Update in Subject line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error with Import sys and not Import os; Also in code I have imported Import sys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Aug 2015 20:00:01 GMT</pubDate>
    <dc:creator>DataProductMgr</dc:creator>
    <dc:date>2015-08-17T20:00:01Z</dc:date>
    <item>
      <title>Python HIVE UDF (Import os) module missing</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30845#M7014</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have completed my DE 575 exam today (8/16) at 6pm CST. There was a question where I have created an python UDF for HIVE&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The program didn't work because sys.stdin didn't work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used&amp;nbsp;&lt;/P&gt;&lt;P&gt;#! usr/bin/python ---&amp;gt; As mentioned in the exam&lt;/P&gt;&lt;P&gt;import os&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for line in sys.stdin:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;lt;Code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the Hive query the streaming didn't happen.&lt;/P&gt;&lt;P&gt;I got&amp;nbsp;an 'error:2000' at MapReduce program from Hive Query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the same program standalone with 'cat' command on the environment and it didn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I lost lot of time in debugging, and unable to solve the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the Cloudera team to let me know&amp;nbsp;whether "import os" module is actually present or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Without that module the HIVE UDF in python doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ref:&lt;/P&gt;&lt;P&gt;1) I performed operations as per this Blog&lt;/P&gt;&lt;P&gt;&lt;A href="http://spryinc.com/blog/guide-user-defined-functions-apache-hive" target="_blank"&gt;http://spryinc.com/blog/guide-user-defined-functions-apache-hive&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) Got an error after trying somewhat similar to this and got a problem somewhat similar&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/32032154/apache-hive-getting-error-while-using-python-udf" target="_blank"&gt;http://stackoverflow.com/questions/32032154/apache-hive-getting-error-while-using-python-udf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Get an IO error like the one below if I recall correctly&lt;/P&gt;&lt;P&gt;&lt;A href="http://grepcode.com/file/repo1.maven.org/maven2/co.cask.cdap/hive-exec/0.13.0/org/apache/hadoop/hive/ql/ErrorMsg.java" target="_blank"&gt;http://grepcode.com/file/repo1.maven.org/maven2/co.cask.cdap/hive-exec/0.13.0/org/apache/hadoop/hive/ql/ErrorMsg.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="line"&gt;&lt;PRE&gt;SCRIPT_IO_ERROR(20001,&amp;nbsp;&lt;SPAN class="strliteral"&gt;"An&amp;nbsp;error&amp;nbsp;occurred&amp;nbsp;while&amp;nbsp;reading&amp;nbsp;or&amp;nbsp;writing&amp;nbsp;to&amp;nbsp;your&amp;nbsp;custom&amp;nbsp;script.&amp;nbsp;" &amp;nbsp;+&amp;nbsp;&lt;SPAN class="strliteral"&gt;"It&amp;nbsp;may&amp;nbsp;have&amp;nbsp;crashed&amp;nbsp;with&amp;nbsp;an&amp;nbsp;error."&lt;/SPAN&gt;),&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV class="line"&gt;&lt;DIV class="lnml"&gt;&lt;IMG src="https://ip1.i.lithium.com/4c2ad7fa179a9e82a15883945effbe806c59fb22/687474703a2f2f67726570636f64652e636f6d2f7374617469632f6170702f696d616765732f3178312e676966" border="0" width="16" height="16" /&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;Suman&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:37:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30845#M7014</guid>
      <dc:creator>DataProductMgr</dc:creator>
      <dc:date>2022-09-16T09:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Python HIVE UDF (Import os) module missing</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30868#M7015</link>
      <description>&lt;P&gt;Update in Subject line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error with Import sys and not Import os; Also in code I have imported Import sys&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2015 20:00:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30868#M7015</guid>
      <dc:creator>DataProductMgr</dc:creator>
      <dc:date>2015-08-17T20:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python HIVE UDF (Import os) module missing</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30869#M7016</link>
      <description>&lt;P&gt;Yes, both os and sys are available. As these are part of the standard library these come installed with python and have been verified to exist in the&amp;nbsp;environment.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2015 20:30:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/30869#M7016</guid>
      <dc:creator>dclute</dc:creator>
      <dc:date>2015-08-17T20:30:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python HIVE UDF (Import os) module missing</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/33054#M7017</link>
      <description>&lt;P&gt;I think you could have tried to use Java if that was an option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would actually prefer that to attempting it in Python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have generally had better luck doing SerDes and UDFs in Java.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Oct 2015 00:20:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Python-HIVE-UDF-Import-os-module-missing/m-p/33054#M7017</guid>
      <dc:creator>Qloudera</dc:creator>
      <dc:date>2015-10-18T00:20:53Z</dc:date>
    </item>
  </channel>
</rss>

