团队,
我正在使用红移版本*(8.0.2)。使用 COPY 命令加载数据时,出现错误:-“字符串包含无效或不受支持的 UTF8 代码点,错误的 UTF8 十六进制序列:bf(错误 3)”。
似乎 COPY 试图将 UTF-8“bf”加载到 VARCHAR 字段中。根据 Amazon redshift,此错误代码 3 定义如下:
error code3:
The UTF-8 single-byte character is out of range. The starting byte must not be 254, 255
or any character between 128 and 191 (inclusive).
亚马逊推荐将此作为解决方案 - 我们需要用有效的 UTF-8 代码序列替换该字符或删除该字符。
您能帮我如何用有效的 UTF-8 代码替换该字符吗?
当我检查 PG-ADMIN 中的数据库属性时,它显示编码为 UTF-8。
请指导我如何替换输入分隔文件中的字符。
谢谢...
我在加载 TPC-DS 数据集进行实验时在 RedShift 中遇到了这个问题。
以下是我通过 AWS 找到的文档和论坛讨论:https://forums.aws.amazon.com/ann.jspa?annID=2090 https://forums.aws.amazon.com/ann.jspa?annID=2090
以下是可用于解决数据转换错误的显式命令:http://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html#copy-acceptinvchars http://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-conversion.html#copy-acceptinvchars
您可以在 COPY 阶段通过声明 ACCEPTINVCHARS 显式替换无效的 UTF-8 字符或忽略它们。
尝试这个:
copy table from 's3://my-bucket/my-path
credentials 'aws_iam_role=<your role arn>'
ACCEPTINVCHARS
delimiter '|' region 'us-region-1';
Warnings:
Load into table 'table' completed, 500000 record(s) loaded successfully.
Load into table 'table' completed, 4510 record(s) were loaded with replacements made for ACCEPTINVCHARS. Check 'stl_replacements' system table for details.
0 rows affected
COPY executed successfully
Execution time: 33.51s
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)