Presto SQL 常见报错汇总
Posted 光于前裕于后
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Presto SQL 常见报错汇总相关的知识,希望对你有一定的参考价值。
1.字段类型转换问题 cast
‘message’: ‘Out of range for integer: -61792617943’, ‘errorCode’: 19, ‘errorName’: ‘NUMERIC_VALUE_OUT_OF_RANGE’, ‘errorType’: ‘USER_ERROR’, ‘failureInfo’: ‘type’: ‘com.facebook.presto.spi.PrestoException’, ‘message’: ‘Out of range for integer: -61792617943’, ‘cause’: ‘type’: ‘java.lang.ArithmeticException’, ‘message’: ‘integer overflow’, ‘suppressed’: [], ‘stack’: [‘java.lang.Math.toIntExact(Math.java:1011)’, ‘com.facebook.presto.type.BigintOperators.castToInteger(BigintOperators.java:194)’
此报错说明sql中 cast(xx as int) 类型转换错误,原字段超过了int范围-2^31 (-2,147,483,648) 到 2^31 - 1 (2,147,483,647) -61792617943,排查时 where xx = -61792617943
如果是写入时字段类型不匹配,不会报上面的错,而是下面
‘errorCode’: 1, ‘errorName’: ‘SYNTAX_ERROR’, ‘errorType’: ‘USER_ERROR’, ‘failureInfo’: ‘type’: ‘com.facebook.presto.sql.analyzer.SemanticException’, ‘message’: ‘Insert query has mismatched column types: Table: [varchar, date],Query: [varchar, varchar]’
注意类型转换 Cannot cast,2 是2位,长度是2,有脏数据,排查代码中类型转换且原字符串长度是2的地方
pyhive.exc.DatabaseError: ‘message’: “Cannot cast ‘*2’ to INT”, ‘errorCode’: 9, ‘errorName’: ‘INVALID_CAST_ARGUMENT’, ‘errorType’: ‘USER_ERROR’, ‘failureInfo’: ‘type’: ‘com.facebook.presto.spi.PrestoException’, ‘message’: “Cannot cast ‘*2’ to INT”
PS:
表结构变更导致的 sqoop 报错 空指针 ERROR sqoop.Sqoop: Got exception running Sqoop: java.lang.NullPointerException
以上是关于Presto SQL 常见报错汇总的主要内容,如果未能解决你的问题,请参考以下文章
Navicat向mysql数据库中导入sql文件常见报错问题总结及解决办法