温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。
引用><强> 1。问题描述强>
通过sqoop抽取Mysql表数据到蜂巢表,发现蜂巢表所有列显示为空
蜂巢表的分隔符为“\ u001B sqoop指定的分隔符也是" \ u001B "
通过命令显示创建表test_hive_delimiter查看建表语句如下:
<代码> 0:jdbc: hive2://localhost: 10000/比;显示创建表test_hive_delimiter; … 信息:好的 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + | createtab_stmt | +----------------------------------------------------+--+ |创建外部表“test_hive_delimiter”(| | | ' id ' int |“名字”字符串,| | | '地址'字符串) |行格式SERDE | org.apache.hadoop.hive.serde2.lazy |”。LazySimpleSerDe”| 与SERDEPROPERTIES | | | ' field.delim '=' \ u0015 ', | | ' serialization.format '=' \ u0015 ') | |存储为INPUTFORMAT | org.apache.hadoop.mapred |”。TextInputFormat”| | OUTPUTFORMAT | org.apache.hadoop.hive.ql.io |”。HiveIgnoreKeyTextOutputFormat”| | |位置 |“hdfs://ip - 172 - 31 - 6 - 148. fayson.com: 8020/fayson/test_hive_delimiter ' | | TBLPROPERTIES (| |“COLUMN_STATS_ACCURATE”=凹佟?| | | ' numFiles '=' 0 ', | | ' numRows '=' 1 ', | | ' rawDataSize '=' 1 ', | | ' totalSize '=' 0 ', | | ' transient_lastDdlTime '=' 1504705887 ') +----------------------------------------------------+--+ 22行选择(0.084秒) 0:jdbc: hive2://localhost: 10000/比;代码> >之前
发现蜂巢的原始建表语句中的分隔符是“\ u001B”而通过显示创建表test_hive_delimiter命令查询出来的分隔符为“\ u0015”,分隔符被修改了。
<强> 2。问题复现强>
1。创建蜂巢表test_hive_delimiter,使用“\ u001B”分隔符
<代码> test_hive_delimiter创建外部表 ( id int, 名称字符串, 地址字符串 ) 行格式分隔字段被‘\ u001B终止 存储为文本文件位置/fayson/test_hive_delimiter, 代码>2。使用sqoop抽取MySQL中测试表数据到蜂巢表(test_hive_delimiter)
<代码> [root@ip - 172 - 31 - 6 - 148 ~ # sqoop进口——jdbc连接:mysql://ip - 172 - 31 - 6 - 148. - fayson.com: 3306/fayson根用户名密码123456,表测试- m 1——hive-import fields-terminated-by“\ 0 x001b”——target-dir/fayson test_hive_delimiter——hive-table test_hive_delimiter 代码>数据抽取成功:
<代码> [root@ip - 172 - 31 - 6 - 148 ~ # hadoop fs - ls/fayson/test_hive_delimiter 发现2项 -rw-r - r - 3 fayson超群0 2017-09-06 13:46/fayson/test_hive_delimiter/_SUCCESS -rwxr-xr-x 3 fayson超群56 2017-09-06 13:46/fayson test_hive_delimiter/部分- m - 00000 [root@ip - 172 - 31 - 6 - 148 ~ # hadoop fs - ls/fayson test_hive_delimiter/部分- m - 00000 -rwxr-xr-x 3 fayson超群56 2017-09-06 13:46/fayson test_hive_delimiter/部分- m - 00000 [root@ip - 172 - 31 - 6 - 148 ~ # 代码>
3。查看test_hive_delimiter表数据
<代码> [root@ip - 172 - 31 - 6 - 148 ~ #直线 直线1.1.0-cdh6.12.1版本的Apache蜂巢 beeline>! jdbc连接:hive2://localhost: 10000/;主要=蜂巢/ip - 172 - 31 - 6 - 148. fayson.com@fayson.com … 事务隔离:TRANSACTION_REPEATABLE_READ时 0:jdbc: hive2://localhost: 10000/比;从test_hive_delimiter select *; … 信息:好的 + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + | test_hive_delimiter。id | test_hive_delimiter.name | test_hive_delimiter。地址| + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + 零零零| | | | 零零零| | | | 零零零| | | | + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + 3行选择(0.287秒) 0:jdbc: hive2://localhost: 10000/比;0026 -蜂巢使用十六进制分隔符异常分析