错误码:ODPS-0123091:Illegal type cast
错误1:in function cast, value 'xx' cannot be casted from yy to zz
错误信息示例
ODPS-0123091:Illegal type cast - in function cast, value 'xx' cannot be casted from YY to ZZ
问题描述
执行数据类型转换的时候出错,大多数情况下是由输入的数据不合法导致的。关于MC的数据类型转换,可以参考如下文档:数据类型转换。
解决方案
检查输入数据,必要时先对输入数据进行清洗处理。假如想忽略错误,可以将当前处理模式修改为非严格模式。
Query示例
--准备数据
odps> create table mc_test
(
a string
);
odps> insert overwrite table mc_test
values ('100'), ('-');
--设置当前处理模式为严格模式,集团内部的flag是odps.sql.udf.strict.mode=true,中国公共云对应的flag是odps.function.strictmode
odps> set odps.sql.udf.strict.mode=true;
--错误,因为输入数据'-'不能cast成bigint而且当前工作在strict模式。
odps> select cast(a as bigint)
from mc_test;
FAILED: ODPS-0123091:Illegal type cast - in function cast, value '-' cannot be casted from String to Bigint
反馈
- 本页导读 (1)
文档反馈