forked from shashank-mishra219/Hive-Class
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhive-class-3.txt
More file actions
34 lines (22 loc) · 2.03 KB
/
hive-class-3.txt
File metadata and controls
34 lines (22 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# first load data as csv
create table sales_data_v2
> (
> p_type string,
> total_sales int
> )
> row format delimited
> fields terminated by ',';
load data local inpath 'file:///tmp/hive_class/sales_data_raw.csv' into table sales_data_v2;
# command to create identical table
create table sales_data_v2_bkup as select * from sales_data_v2;
# describe command for a table
describe extended sales_data_v2;
# create a table which will store data in parquet
create table sales_data_pq_final
> (
> product_type string,
> total_sales int
> )
> stored as parquet;
# load data in parquet file
from sales_data_v2 insert overwrite table sales_data_pq_final select *;