蜂巢Python UDF
我正在使用以下Python UDF脚本:蜂巢Python UDF,python,hadoop,hive,hive-udf,Python,Hadoop,Hive,Hive Udf,我正在使用以下Python UDF脚本: import sys import collections import datetime import re try: for line in sys.stdin: line=line.strip() number,sd=line.split('\t') sd=sd.lower() sd=sd.split(' ') new_sd_list=collection
import sys
import collections
import datetime
import re
try:
for line in sys.stdin:
line=line.strip()
number,sd=line.split('\t')
sd=sd.lower()
sd=sd.split(' ')
new_sd_list=collections.OrderedDict(collections.Counter(sd))
new_sd=' '.join(new_sd_list)
print('\t'.join([str(number),str(new_sd])))
except:
print(sys.exc_info())
在Putty中执行以下命令时
SELECT TRANSFORM(number,shortdescription) USING 'python name.py' \
AS (number,shortdescription) FROM table;
我得到这个错误:
原因:org.apache.hadoop.hive.ql.metadata.HiveException:处理行{“number”:“ABC00548”,“shortdescription”:“印度优化器中的主数据不一致性检查”。}
失败:执行错误,从org.apache.hadoop.hive.ql.exec.mr.MapRedTask返回代码2
推出MapReduce作业:
阶段1:映射:4 HDFS读取:0 HDFS写入:0失败
花费的MapReduce CPU总时间:0毫秒
添加表DDL和数据样本DDL:number:string shortdescription:string示例数据:“number”:“ABC0003888”“shortdescription”:“清理DRUPAL中用于Agricast天气页面和DRUPAL中历史天气页面的位置名称数据库”“
ABC00548
似乎不是数字,而是字符串。”。。表中的所有文件都是字符串,我认为错误可能是因为短描述中的unicode,因为有些情况下短描述类似于“EXTRAPRÁTICA-SEAC”,如果发生这种情况,如何再次更正,请添加表DDL(show create table..
)和数据示例(~10行)添加表DDL和数据样本DDL:number:string shortdescription:string示例数据:“number”:“ABC0003888”“shortdescription”:“清理DRUPAL中用于Agricast天气页面和DRUPAL中历史天气页面的位置名称数据库”ABC00548
似乎不是数字,而是字符串。。表中的所有文件都是字符串,我认为错误可能是因为短描述中的unicode,因为有些情况下短描述类似于“EXTRAPRÁTICA-SEAC”,如果发生这种情况,如何再次更正,请添加表DDL(show create table..
)和数据示例(~10行)
import sys
import collections
import datetime
import re
try:
for line in sys.stdin:
line=line.strip()
number,sd=line.split('\t')
sd=sd.lower()
sd=sd.split(' ')
new_sd_list=collections.OrderedDict(collections.Counter(sd))
new_sd=' '.join(new_sd_list)
print('\t'.join([str(number),str(new_sd)])) #syntax error
except:
print(sys.exc_info())