大数据相关代码

创建表

drop table if exists database.table
create external table database.name(id string,name string) ROW FORMAT DELIMITED FIELDS TERMINATED BY  ','  STORED AS TEXTFILE location   '/data/'; 

-------------------------------------------------------------------------------------------------------------------------------------

drop table if exists  database.table;
CREATE external TABLE database.table(
id string,

name string 
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
   "separatorChar" = ",",
   "quoteChar"     = '"'
)
location '/data/path'
TBLPROPERTIES('skip.header.line.count'='1')

-------------------------------------------------------------------------------------------------------------------------------------

insert overwrite database.table select

------------------------------------------------------------------------------------------------------------------------------------

 

hadoop 命令

hdfs dfs -put -f /file.csv   /hdfspath

yarn top

 yarn application -kill application_id

hadoop fs -ls /

hadoop fs -cat /file

hadoop fs -mkdir /code/

 

 

你可能感兴趣的:(Big,data,Hive,HQL)