sqoop-as parquetfile:导入文件中的类型错误

mm5n2pyu  于 2021-05-30  发布在  Hadoop
关注(0)|答案(0)|浏览(225)

我使用的是cloudera的quckstart cdh5.4 vmware映像。其中包含sqoop1.4.5。
我从一个非常简单的oracle database 10g enterprise edition 10.2.0.4.0版导入64位生产表:

create table SIMPLETBL (
        id NUMBER(38,0),
        firstname varchar2(64),
        lastname varchar2(64),
        entry date
);

我导入到hdfs中的一个暂存目录,使用 sqoop 调用:


# !/bin/bash

sqoop  import \
    --verbose \
    --username theuser --password thepassword \
    --connect jdbc:oracle:thin:@x.y.z.x:1565:sidd \
    --table THEUSER.SIMPLETBL \
    --target-dir /archive/xxx/stage_pk \
    -m 1 --as-parquetfile

hdfs目录 /archive//stage_pk 创建人 sqoop ,一个文件就结束了。我把它移到Parquet桌的目录里:

hdfs dfs -mv /archive/xxx/stage_pk/\*  /archive/xxx/pktbl
``` `impala-shell` 告诉我关于我的Parquet文件表:

[quickstart.cloudera:21000] > select * from pktbl limit 10;
Query: select * from pktbl limit 10
ERROR: File 'hdfs://quickstart.cloudera:8020/archive/xxx/pktbl/afd5eba5-b1e9-462b-9e23-3df6dcdfab22.parquet'
has an incompatible type with the table schema for column 'ID'.
Expected type: INT32. Actual type: BYTE_ARRAY

两列 `firstname` 以及 `lastname` 似乎正确地进入了Parquet地板表,但日期格式列没有:

[quickstart.cloudera:21000] > select entry from pktbl limit 10;
Query: select entry from pktbl limit 10
ERROR: File 'hdfs://quickstart.cloudera:8020/archive/xxx/pktbl/afd5eba5-b1e9-462b-9e23-3df6dcdfab22.parquet'
has an incompatible type with the table schema for column 'ENTRY'.
Expected type: INT96. Actual type: INT64

有什么窍门吗 `sqoop` 创建一个Parquet文件 `impala` 你能理解吗?好像 `sqoop` 1.4.5错误获取除“string”以外的所有数据类型。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题