准备数据集
创建hive表(根据需求创建内部表或者外部表)
create external TABLE IF NOT EXISTS test.FFL2_TAQ_tmp
(
TradingDate STRING,
TradingTime STRING,
Symbol STRING,
OpenPrice STRING,
LastPrice STRING,
HighPrice STRING,
LowPrice STRING,
SettlePrice STRING,
PreSettlePrice STRING,
ClosePrice STRING,
PreClosePrice STRING,
TradeVolume STRING,
TotalVolume STRING,
TradeAmount STRING,
TotalAmount STRING,
PreTotalPosition STRING,
TotalPosition STRING,
PrePositionChange STRING,
PriceUpLimit STRING,
PriceDownLimit STRING,
BuyOrSell STRING,
OpenClose STRING,
BuyPrice01 STRING,
BuyPrice02 STRING,
BuyPrice03 STRING,
BuyPrice04 STRING,
BuyPrice05 STRING,
SellPrice01 STRING,
SellPrice02 STRING,
SellPrice03 STRING,
SellPrice04 STRING,
SellPrice05 STRING,
BuyVolume01 STRING,
BuyVolume02 STRING,
BuyVolume03 STRING,
BuyVolume04 STRING,
BuyVolume05 STRING,
SellVolume01 STRING,
SellVolume02 STRING,
SellVolume03 STRING,
SellVolume04 STRING,
SellVolume05 STRING,
Delta STRING,
PreDelta STRING,
SettleGroupID STRING,
SettleID STRING,
Change STRING,
ChangeRatio STRING,
ContinueSign STRING,
Market STRING,
UNIX STRING,
PositionChange STRING,
ContinueSignName STRING,
SecurityID STRING,
ShortName STRING,
AveragePrice STRING,
OrderRate STRING,
OrderDiff STRING,
Amplitude STRING,
VolRate STRING,
SellVOL STRING,
BuyVOL STRING
)
row format serde 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES
(
"separatorChar"=","
)
tblproperties("skip.header.line.count"="1") -- 跳过第一行
STORED AS TEXTFILE;
加载数据到hive表中
load data local inpath 'xxxx.csv.gz' overwrite into table xxx库.xxx表;