select case when "ab1234"<>"123" then 1 else 0 end as flag from src limit 1;
1
select case when "ab1234"<>123 then 1 else 0 end as flag from src limit 1;
0
select case when "ab1234"<> cast(123 as bigint) then 1 else 0 end as flag from src limit 1;
0
"ab1234"<>123 两个类型进行比较时:
123转换double
"ab1234"也要转换成double进行比较,但是转换时转换不成,返回null。
所以"ab1234"<>123进行比较时返回null,不为true。
代码在GenericUDFBaseCompare中。
https://issues.apache.org/jira/browse/HIVE-2248
1
select case when "ab1234"<>123 then 1 else 0 end as flag from src limit 1;
0
select case when "ab1234"<> cast(123 as bigint) then 1 else 0 end as flag from src limit 1;
0
"ab1234"<>123 两个类型进行比较时:
123转换double
"ab1234"也要转换成double进行比较,但是转换时转换不成,返回null。
所以"ab1234"<>123进行比较时返回null,不为true。
代码在GenericUDFBaseCompare中。
https://issues.apache.org/jira/browse/HIVE-2248