Java 在配置单元中将字符串隐式转换为int时会发生什么?
在使用配置单元查询数据时,遇到以下这种情况:Java 在配置单元中将字符串隐式转换为int时会发生什么?,java,hadoop,hive,Java,Hadoop,Hive,在使用配置单元查询数据时,遇到以下这种情况: 选择“645598305454469410”=645598305454699395==>true 所以我想知道在配置单元中将字符串隐式转换为int时会发生什么 谢谢。双方都被选为替补 hive> select '6455983054544699410' = 6455983054544699395; WARNING: Comparing a bigint and a string may result in a loss of precisi
选择“645598305454469410”=645598305454699395==>true
所以我想知道在配置单元中将字符串隐式转换为int时会发生什么
谢谢。双方都被选为替补
hive> select '6455983054544699410' = 6455983054544699395;
WARNING: Comparing a bigint and a string may result in a loss of precision.
OK
_c0
true
双方都被要求加倍努力
hive> select '6455983054544699410' = 6455983054544699395;
WARNING: Comparing a bigint and a string may result in a loss of precision.
OK
_c0
true
// For now, if a bigint is going to be cast to a double throw an error or warning
if ((oiTypeInfo0.equals(TypeInfoFactory.stringTypeInfo) && oiTypeInfo1.equals(TypeInfoFactory.longTypeInfo)) ||
(oiTypeInfo0.equals(TypeInfoFactory.longTypeInfo) && oiTypeInfo1.equals(TypeInfoFactory.stringTypeInfo))) {
String error = StrictChecks.checkTypeSafety(conf);
if (error != null) throw new UDFArgumentException(error);
console.printError("WARNING: Comparing a bigint and a string may result in a loss of precision.");
} else if ((oiTypeInfo0.equals(TypeInfoFactory.doubleTypeInfo) && oiTypeInfo1.equals(TypeInfoFactory.longTypeInfo)) ||
(oiTypeInfo0.equals(TypeInfoFactory.longTypeInfo) && oiTypeInfo1.equals(TypeInfoFactory.doubleTypeInfo))) {
String error = StrictChecks.checkTypeSafety(conf);
if (error != null) throw new UDFArgumentException(error);
console.printError("WARNING: Comparing a bigint and a double may result in a loss of precision.");
}