Re: how to combine some rows into 1 row in hive

2013-06-22 Thread zuohua zhang
treaming feature is a nice option for this as it is a fairly > natural way to work with entire rows and return multiple columns > > select transform a,b,c,d using /bin/pipeprogram as a, b ,c ,d > > You an also write a UDTF user defined Table function as well because this > can re

Re: how to combine some rows into 1 row in hive

2013-06-22 Thread zuohua zhang
using /bin/pipeprogram as a, b ,c ,d > > You an also write a UDTF user defined Table function as well because this > can return more then one column. > > On Sat, Jun 22, 2013 at 6:36 PM, zuohua zhang wrote: > >> I have the following table: >> f1 f2 f3 f4 f5 >> a1 a2 P

how to combine some rows into 1 row in hive

2013-06-22 Thread zuohua zhang
I have the following table: f1 f2 f3 f4 f5 a1 a2 P x1 x2 a1 a2 N x3 x4 a1 a3 N x5 x6 a4 a6 P x7 x8 i want to convert to below: f1 f2 pf4 pf5 nf4 nf5 a1 a2 x1 x2 x3 x4 a1 a3 0 0 x5 x6 a4 a6 x7 x8 0 0 basically, when f3="P", I want f4 f5 to be moved to pf4 pf5 when f3="N", i want f4 f5 to be moved

how to export to a csv file?

2012-09-22 Thread zuohua zhang
I tried the following: CREATE TABLE test ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n' STORED AS TEXTFILE AS select * from test_new; set hive.io.output.fileformat=CSVTextFile; INSERT OVERWRITE DIRECTORY '/test' select * from test; hadoop dfs -getmerge /test /mnt/test

date format question

2012-09-17 Thread zuohua zhang
I have a date column in this format: Mon Jul 16 14:05:12 PDT 2012 I want to select all records > 2012-09-01. How to do? Thanks!

Re: most efficient way to concatenate 3 tables into one?

2012-09-12 Thread zuohua zhang
his new table's location. Just a > hdfs copy or move is not that expensive. > Regards > Bejoy KS > > Sent from handheld, please excuse typos. > ------ > *From: * zuohua zhang > *Date: *Wed, 12 Sep 2012 13:02:42 -0700 > *To: * > *ReplyTo: * user@

Re: question on output hive table to file

2012-08-06 Thread zuohua zhang
;,', col2, ',', col3) from myoutputtable; > > That way columns will be separated by ,. > > Thanks, > Vinod > > > On Tue, Aug 7, 2012 at 10:16 AM, zuohua zhang wrote: > >> I used the following that it won't help? >> >> ROW FORMAT

Re: question on output hive table to file

2012-08-06 Thread zuohua zhang
n to have a separator of > your choice. > > Thanks, > Vinod > > > On Tue, Aug 7, 2012 at 9:39 AM, zuohua zhang wrote: > >> I have used the following to output a hive table to a file: >> DROP TABLE IF EXISTS myoutputable; >> CREATE TABLE myoutputtable >

question on output hive table to file

2012-08-06 Thread zuohua zhang
I have used the following to output a hive table to a file: DROP TABLE IF EXISTS myoutputable; CREATE TABLE myoutputtable ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE AS select * from originaltable; INSERT OVERWRITE DIRECTORY '/outputable.txt' select * from myoutputtable; then