2013-04-11 关于自定义format

来源:互联网 发布:mysql什么是事务实例 编辑:程序博客网 时间:2024/06/05 22:54
1 hivelib下的jar包更换了之后,要想语句使用新的jar包,得在hive
cli中执行quit;退出后重新进入。
2在hive-site.xml中加入对jar包的引用,对整个集群都有效。不用每次都add。
<property>
<name>hive.aux.jars.path</name>
<value>file:///opt/hive-0.9.0/lib/hive_ufida.jar</value>
</property>
3 hive不支持insert into table ×× values()这样的语句。
  最多能insert into table ×× select 。。。
4 尝试了自定义inputformat和outputformat来解决分隔符是字符串的问题。
  一开始的时候用新的format建完外部表,再用select查询的时候报错:
*Failed with exception java.io.IOException:java.io.IOException: Cannot
>> create an instance of InputFormat class
>> 我的inputformat路径名 as specified in mapredWork!*
本来还以为是少了jar包之类的。最后发现是因为format类写的有问题。换成一个没问题的format类就ok了。
 create table testhcl11 (ip STRING,identd STRING,username STRING) stored as INPUTFORMAT 'com.chanjet.hive.format.ClickstreamInputFormat' OUTPUTFORMAT 'com.chanjet.hive.format.SSOOutputFormat' location '/test2/';
create table testhcl8 (ip STRING,identd STRING,username STRING) stored as INPUTFORMAT 'com.chanjet.hive.format.ClickstreamInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' location '/test/'; 


5 outputformat对load数据根本不会起作用,load只是数据的复制或者移动,不牵涉到格式化。
  而它对insert into select这种语句就起作用,会在insert往文件写的时候对数据进行格式化。
6 select的时候起作用的就是inputformat了
 
  
原创粉丝点击