vgrabovets
10/30/2016 - 7:23 AM

create external table

create external table

hadoop fs -mkdir /data
hadoop fs -mkdir /data/stocks
hadoop fs -put stocks.csv /data/stocks

CREATE EXTERNAL TABLE stocks (
  exchang         STRING,
  symbol          STRING,
  ymd             STRING,
  price_open      FLOAT,
  price_high      FLOAT,
  price_low       FLOAT,
  price_close     FLOAT,
  volume          INT,
  price_adj_close FLOAT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
LOCATION '/data/stocks';

DROP TABLE stocks;
set hive.cli.print.header=true;
SELECT * FROM stocks LIMIT 10;