Certificação Hortonworks Hadoop FS - Certificação HDP hortonworks

Simulado da prova de certificação HDP Hortonworks

TAREFA 07

Definir e preencher uma tabela ORCFile

Defina uma tabela Hive chamada sfo_weather que satisfaça todos os seguintes critérios:
  1. Uma tabela gerenciada pelo Hive
  2. Os dados são armazenados no formato ORCFile
  3. A tabela deve ser preenchida com os registros no arquivo /home/horton/datasets/flightdelays/sfo_weather.csv na máquina cliente
  4. O esquema corresponde às colunas em sfo_weather.csv - a primeira coluna é uma string chamada station_name, seguida de números inteiros para o Year, Month, DayOfMonth, precipitation, temperature_max e temperature_min

Script

-- define a tabela
create table sfo_weather_text (station_name string, year int, month int, dayofmonth int, precipitation int, 
temperature_max int, temperature_min int) 
row format delimited 
fields terminated by ',';
-- carrega com os dados do sfo_weather.csv 
load data local inpath '/home/horton/datasets/flightdelays/sfo_weather.csv' into table sfo_weather_text;
-- armazena os dados no formato ORCFile
create table sfo_weather stored as Orc as select * from sfo_weather_text;

Obrigado

Até a próxima