HIVE布尔过滤器

时间:2021-07-09 07:44:20

标签: sql filter hive boolean impala

我正在尝试使用布尔列过滤 HIVE/IMPALA 中的表,但不知何故我收到“处理语句时出错”

我的查询是这样的select * from schema_name.table_name where boolean_col is TRUE

想知道这种过滤器的正确查询。 TIA

1 个答案:

答案 0 :(得分:0)

正确的语法是 where boolean_col = True

您不需要额外的比较,只需按原样使用列,它已经是布尔值:

select * from schema_name.table_name 
 where boolean_col

并选择带有 boolean_col = False 的行使用 NOT:

select * from schema_name.table_name 
 where NOT boolean_col

要检查 NULL 使用 boolean_col is NULL