impala建表脚本
程序员文章站
2022-03-05 14:32:42
...
IMPALA="sudo -u hdfs impala-shell -q"
db_name="chenzl"
table_name="kn1_base_conf_group"
$IMPALA<< EOF
USE ${db_name};
DROP TABLE ${table_name};
CREATE EXTERNAL TABLE ${table_name}
(
day_key string comment'日期',
group_id bigint comment'组编号',
group_name string comment'组名称',
realgroup_id bigint comment'真实组编号',
realgroup_name string comment'真实组名称',
app_service_id bigint comment'应用服务编号',
app_service_name string comment'应用服务名称',
service_state string comment'服务状态',
node_id bigint comment'节点编号',
node_name string comment'节点名称',
area string comment'区域',
province string comment'省份',
isp string comment'运营商编码',
isp_cnname string comment'运营商名称',
province_name string comment'省份名称',
area_name string comment'大区'
)
COMMENT '组信息维度表'
ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' LINES TERMINATED BY '\n'
STORED AS TEXTFILE
LOCATION '/user/hive/warehouse/dw/kn1_base_conf_group';
ALTER TABLE ${table_name} SET SERDEPROPERTIES('serialization.null.format'='');
EOF
ALTER TABLE kn1_base_conf_group SET SERDEPROPERTIES('serialization.null.format'='');
上一篇: Anaconda+python3.6+Impala的安装历程
下一篇: Impala负载均衡方案