|
Soren Flexner |
at Apr 23, 2011 at 6:09 pm
|
⇧ |
| |
The data in hive sits in (tabular) files on HDFS. The "tables" in hive are
metadata overlays to those files. If the files you're interested in
pointing Hive to are tab delimited, you need to tell Hive that fact when you
"create" the table (metadata). This happens in CREATE TABLE.
See the second-to-last line:
CREATE TABLE u_data (
userid INT,
movieid INT,
rating INT,
unixtime STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
STORED AS TEXTFILE;
http://wiki.apache.org/hadoop/Hive/GettingStartedIf you want to have Hive output a different delimiter than the one that's
native to the data you have stored on HDFS, you could try altering it just
after the fact. For instance,
hive -e 'select * from myTable' | sed 's/oldDelimiter/newDelimiter/g' >
outputFile.newDelimiter
-s
On Fri, Apr 22, 2011 at 10:07 PM, Erix Yao wrote:
As I know, all the data exported from hive use ASCII \001 as the default
field delimiter, and I want to change it, How can I achieve this?
Thanks
--
haitao.yao@Beijing