首页 > 技术文章 > 向Impala里Insert数据时报错:(type: STRING) would need to be cast to VARCHAR(100) for column

canwyq 2018-09-04 16:29 原文

向Impala里Insert数据时报错:(type: STRING) would need to be cast to VARCHAR(100) for column

 

原SQL

 INSERT INTO CTS.attribute (id ,attCode)VALUES (2 , 'supplier');

执行时报错:

AnalysisException: Possible loss of precision for target table 'CTS.attribute'. Expression ''supplier'' (type: STRING) would need to be cast to VARCHAR(100) for column 'attcode'

 

修改为:

 INSERT INTO CTS.attribute (id ,attCode)VALUES (2 , CAST('supplier' AS varchar(100)));

 

推荐阅读