cloudera sqoop在导入时将某些列Map为空值

xt0899hw  于 2021-06-02  发布在  Hadoop
关注(0)|答案(2)|浏览(343)

在导入中将某些列转换为空占位符的最佳方法是什么?
是否可以使用Map列功能?

Argument    Description
--map-column-java <mapping> Override mapping from SQL to Java type for configured columns.
--map-column-hive <mapping> Override mapping from SQL to Hive type for configured columns.

我们希望模式是相同的,但有些列只是持有大量的膨胀,所以我们不希望他们拉到我们的集群。另一种思想是生成自定义select语句,其中臃肿的列为null,但这要比sqoop配置多得多,而且我们要Map1000个表。

--map-column-java bloatedcolname=null

思想?

vql8enpb

vql8enpb1#

你可以用 --query 为了这个
例如:

sqoop import --query 'select a, b, null as c, null as d from tbl where $CONDITIONS'
``` `$CONDITIONS` 用于替换拆分的最小值和最大值。
n3h0vuf2

n3h0vuf22#

简单使用 --columns <col1, col2, col3…> 在配置单元导入查询中。
排除不想导入的列。
例子:
我在rdbms中有四列-id,name,occupance,address,我只想导入id和name。
使用 --columns id, name 在导入命令中。

相关问题