如何将括号括起来的行表加载到Hive中?

时间:2019-05-09 18:57:24

标签: hive

我想从mysql dump生成的文件中创建一个Hive表,该表的每一行都用括号括起来并用逗号分隔。括号内的字段也以逗号分隔。

文件的前几个“行”如下所示:

(1,'Name','Name','LastName','LastName',44,'1971-12-08',13,14,'xxxx','xxxx',7,0,9,1,0,0,'2012-11-05 14:58:33','2011-08-20 04:43:02','2014-12-04 11:33:23','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,47,0,1,'\0'),(2,'Name','Name','LastName','LastName',44,'2014-02-07',0,14,'xxxx','xxxx',139,0,9,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-07-29 13:15:46','0000-00-00 00:00:00',1,'0',1,0,0,0,0,0,5,0,1,'\0'),(3,'Name','Name','LastName','LastName',44,'1996-04-18',13,14,'xxxx','',4,0,1,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-04-18 00:01:00','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,0,1,1,'\0'),(4,'Name','Name','LastName','LastName',44,'1976-05-11',12,15,'xxxx','',5,0,1,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-05-11 00:01:00','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,42,0,1,'\0'),

以终止的文件的外观如何

(1,'Name','Name','LastName','LastName',44,'1971-12-08',13,14,'xxxx','xxxx',7,0,9,1,0,0,'2012-11-05 14:58:33','2011-08-20 04:43:02','2014-12-04 11:33:23','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,47,0,1,'\0'),
(2,'Name','Name','LastName','LastName',44,'2014-02-07',0,14,'xxxx','xxxx',139,0,9,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-07-29 13:15:46','0000-00-00 00:00:00',1,'0',1,0,0,0,0,0,5,0,1,'\0'),
(3,'Name','Name','LastName','LastName',44,'1996-04-18',13,14,'xxxx','',4,0,1,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-04-18 00:01:00','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,0,1,1,'\0'),
(4,'Name','Name','LastName','LastName',44,'1976-05-11',12,15,'xxxx','',5,0,1,0,7,0,'0000-00-00 00:00:00','2011-08-20 04:43:02','2015-05-11 00:01:00','0000-00-00 00:00:00',0,'0',0,0,0,0,0,0,42,0,1,'\0'),

预期结果是一个表,其中用括号括起来的每行填充表的一行,并且每个逗号分隔的字段填充一列,其结构类似于以下内容:

ID    |    Value 1    |    Value 2    |    Value 3    |    Value 4    |    Value 5    |    Value 6    | ...    
1     |    Name       |    Name       |    LastName   |    LastName   |    44         |    1971-12-08 | ...

0 个答案:

没有答案