2017-05-16 3 views
1

Ich habe ein einfaches Python-SkriptHive Python UDF Fehler

#!/usr/local/bin/python 
import sys 
import datetime 
for line in sys.stdin: 
line = line.strip() 
fname , lname = line.split('\t') 
l_name = lname.lower() 
print '\t'.join([fname, str(l_name)]) 

Die Daten Hive Tabelle wie folgt aussieht:

Akash Gupta 
Ashish Agarwal 
Aarav Kedia 
Rajesh Lakhia 
Sunita Patel 
Raj  Dutta 
Nadeem Siddiqui 

Und Tabellenstruktur ist:

hive> desc fullName; 
OK 
fname     string 
lname     string 

Ich füge meine Python Script als:

add FILE /full-path-to-the-script/convertToLowerCase.py; 
Jetzt

, ich bin mit einer Transformationsoperation für das Skript:

SELECT TRANSFORM(fname, lname) USING 'python convertToLowerCase.py' AS (fname, l_name) FROM fullName; 

Aber die Karte Job reduzieren wirft Fehler: FAILED: Execution Error, return code 20003 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. An error occurred when trying to close the Operator running your custom script.

Was mache ich falsch?

Antwort

0

Es gab einen Fehler beim Python-Code. Die Indentation of the For Loop.

Das löste das Problem.

Verwandte Themen