[英]In Hive, if(field1=field2=field3=0,'0','1') is not giving expected results
In Hive query, in the single IF condition, I provided multiple fields check, but not giving the expected results.在Hive查询中,在单IF条件下,我提供了多字段检查,但没有给出预期的结果。
Query:询问:
select ID, field1, field2, field3,
if(field1=field2=field3=0,'0','1') as compare_check
from input_table;
input_table输入表
Output results: Output 结果:
Multiple conditions wont work here.多个条件在这里不起作用。 Could you please separate all conditions?你能把所有条件分开吗? Also make sure all fields doesn't have any extra space etc. around them.还要确保所有字段周围没有任何额外的空间等。
if(field1=field2 and field1=field3
and field1=0,'0','1')
There is another way to do it -还有另一种方法 -
If (field1+field2+field3=0,0,1)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.