1

我正在加入两个文件。一个文件是从table(in0 port)具有这样的记录格式中提取的utf8 string("\x01", maximum_length=3)
另一个文件是正常text file(in1 port)的,具有这样的记录格式ascii string(3)

加入时出现以下错误:

Field "company" in key specifier for input in1 has type "ascii string(3)",
but field "kg3_company_cd" in key specifier for input in0 has type "utf8 string("\x01", maximum_length=3)".
This join may be attempted in spite of the type mismatch by
setting configuration variable AB_ALLOW_DANGEROUS_KEY_CASTING to true.
However, typically the input streams will have been hash-partitioned on
the join keys of different types, making it unlikely that all equal join.
4

1 回答 1

0

问题是 utf8 字符串和 ascii 字符串是不同的基础数据,代表相同的值。您收到的错误消息是警告您,如果您的联接并行运行,则哈希分区算法可能会将匹配的键值从每个流发送到不同的分区,因为表示“相等”字符串的基础数据不同. 例如:如果两个流都有 3 条记录,其中键字段值为(“A”、“AB”、ABC”),则键“AB”可能在一个流的分区 0 上,而在另一个流的分区 7 上。连接组件将为每个分区运行一个实例,期望数据被正确分区。分区 0 的实例将在一个流上看到键“AB”,但在另一个流上看不到。如果它是内部连接,你巧合地发送到输出上的同一分区。

您应该选择您想要的字符串编码,并确保两个流在连接之前都具有匹配的编码。只需添加一个重新格式化之前。

于 2015-03-14T18:42:10.897 回答