select 配置单元中特定位为零的行

select rows with specific bits equal to zero in hive

我想 select 在配置单元中,int 列 ("flags") 的位 10-12 的所有行都等于 0。

我会写什么样的查询来做到这一点?

您可以尝试 shifleft() 和按位与:

where (intcol & shiftleft(1, 10)) = 0 and
      (intcol & shiftleft(1, 11)) = 0 and
      (intcol & shiftleft(1, 12)) = 0