【发布时间】:2021-09-19 14:15:37
【问题描述】:
我正在尝试使用布尔列过滤 HIVE/IMPALA 中的表,但不知何故我得到“处理语句时出错”
我的查询是这样的select * from schema_name.table_name where boolean_col is TRUE
想知道这种过滤器的正确查询。 TIA
【问题讨论】:
标签: sql filter hive boolean impala
我正在尝试使用布尔列过滤 HIVE/IMPALA 中的表,但不知何故我得到“处理语句时出错”
我的查询是这样的select * from schema_name.table_name where boolean_col is TRUE
想知道这种过滤器的正确查询。 TIA
【问题讨论】:
标签: sql filter hive boolean impala
正确的语法是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
【讨论】: