我试图编写一个配置单元UDF,它检查配置单元表中的列,并将字符串与列连接起来。我的配置单元表-cityTab架构和数据:
Schema:
id int
name char(30)
rank int
Data:
1 NewYork 10
2 Amsterdam 30
我编写了以下配置单元UDF:
public class MyHiveUdf extends UDF {
private Text result = new Text();
public Text evaluate(Text text) {
if(text == null) {
return null;
} else {
String str = text.toString();
if(str.contains("NewYork")) {
result.set(text.toString().concat(" America"));
}
return result;
}
}
}
ADD jar /home/cloudera/Desktop/HiveStrCon.jar;
create temporary function strcon as 'com.hiveudf.strmnp.MyHiveUdf';
select strcon(name) from cityTab;
OK
NewYork
Amsterdam
Time taken: 0.191 seconds, Fetched: 3 row(s)
我已经尝试了你的例子,它运行良好,在我的最后,只是做了一个小的修改代码
public class MyHiveUdf extends UDF {
private Text result = new Text();
public Text evaluate(Text text) {
if(text == null) {
return null;
} else {
String str = text.toString();
if(str.contains("NewYork")) {
result.set(text.toString().concat(" America"));
return result;
}
return text;
}
}
hive> ADD jar /root/HiveStrCon.jar;
Added [/root/HiveStrCon.jar] to class path
Added resources: [/root/HiveStrCon.jar]
hive> create temporary function strcon as 'com.hiveudf.strmnp.MyHiveUdf';
OK
Time taken: 0.005 seconds
hive> select strcon(name) from cityTab;
Query ID = root_20170331132222_690e8d43-381c-4e40-a90b-368397c1df5b
Total jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_1490796950103_0007, Tracking URL = http://mac127:8088/proxy/application_1490796950103_0007/
Kill Command = /opt/cloudera/parcels/CDH-5.9.0-1.cdh5.9.0.p0.23/lib/hadoop/bin/hadoop job -kill job_1490796950103_0007
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0
2017-03-31 13:22:42,264 Stage-1 map = 0%, reduce = 0%
2017-03-31 13:22:50,720 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 2.14 sec
MapReduce Total cumulative CPU time: 2 seconds 140 msec
Ended Job = job_1490796950103_0007
MapReduce Jobs Launched:
Stage-Stage-1: Map: 1 Cumulative CPU: 2.14 sec HDFS Read: 3166 HDFS Write: 26 SUCCESS
Total MapReduce CPU Time Spent: 2 seconds 140 msec
OK
NewYork America
Amsterdam
Time taken: 19.788 seconds, Fetched: 2 row(s)
但是eclipse向我显示了一个错误,告诉我它找不到http://java.sun.com/portlet_2_0的标记库描述符。 如何使用tld文件解决此问题?
我正在尝试将mopub添加到我的应用程序中。我通过AndroidStudio插件安装了sdk。并将其添加到我的xml中 在com.example.hroshandel.myapplication.simpleintro_fragmentactivity.oncreate(Simpleintro_fragmentactivity.java:20) 由:java.lang.ClassNotFoundE
我不知道这个,但我得到了以下路线的stacktrace: 有什么明显的问题吗?
我是乌斯金·贾斯珀报道。在develop中,它工作得很好。但在编译jar时,系统会抛出“src/main/resources/reports/myJasperReport.jxml”的异常并将其FileNotFound 当我探索JAR时,我发现报告的URL是"/BOOT-INF/class/resport/myJasperReport.jxml" 我发现这个指向jar内文件的链接不可见,但并没有解
我用create-react-app开始这个项目,然后弹出。我正在分析我的webpack包,我得到了这个。 我运行这个命令来分析我的捆绑包- 我有几个问题- > 我在我的应用程序中使用了moment.js,但是当查看我的package.json时,它不在那里。它确实存在于我的纱锁里。为什么会出现这种情况?为什么我的应用程序还能工作? 我使用lodash,但我已经注意导入特定的lodash函数(例如