· 6 years ago · Jun 10, 2019, 08:46 AM
1romanchenko-mbp:scripts bohdan.romanchenko$ cat db-create.sql
2CREATE DATABASE IF NOT EXISTS bd;romanchenko-mbp:scripts bohdan.romanchenko$
3romanchenko-mbp:scripts bohdan.romanchenko$
4romanchenko-mbp:scripts bohdan.romanchenko$ cat fake-news/create.sql
5use bd;
6
7drop table fake_news_table;
8
9create external table fake_news_table
10(
11 title string,
12 description string,
13 type string,
14 language string,
15 author_info struct
16 <
17 first_name: string,
18 last_name: string,
19 title: string
20 >,
21 country string,
22 category string,
23 added_date date,
24 priority int,
25 logo_info struct
26 <
27 link: string,
28 alt: string
29 >
30)
31partitioned by (year int, month string)
32clustered by (type, category, country) into 2 buckets
33ROW FORMAT serde 'org.openx.data.jsonserde.JsonSerDe'
34LOCATION 'hdfs://namenode:8020/tables_data/fake_news/';romanchenko-mbp:scripts bohdan.romanchenko$ cat fake-news/create.sql