把上图转化为下图,SQL 谁会写 ?type 除了外卖、堂食,可能还有外卖2、外卖3、外卖4.
表结构如下:
CREATE EXTERNAL TABLE `tmp.shop_detail_tb`(
`id` string COMMENT '',
`name` string COMMENT '',
`type` string COMMENT '',
`amt` string COMMENT '',
`month` string COMMENT ''
)
PARTITIONED BY (
`dt` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
NULL DEFINED AS ''
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';
`id` string COMMENT '',
`name` string COMMENT '',
`type` string COMMENT '',
`amt` string COMMENT '',
`month` string COMMENT ''
)
PARTITIONED BY (
`dt` string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
NULL DEFINED AS ''
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';
下图:
全部评论
(2) 回帖