Skip to content

Commit 1c27b0f

Browse files
committed
-> Trying to sort out bucket bug
1 parent 183e1b0 commit 1c27b0f

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

google_helpers/bigquery/bq_support.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -827,21 +827,22 @@ def build_bq_filter_and_params(filters, comb_with='AND', param_suffix=None, with
827827
query_param = query_params
828828
else:
829829
if operator == 'AND' and len(values) > 1:
830-
# If an operator is to be AND'd with more than one value we must make an intersection statement on the higher-level entity
831-
# (i.e. select for studies which have series containing both values)
832-
# That cannot be performed here
830+
# If an operator is to be AND'd with more than one value we must make an intersection statement
831+
# on the higher-level entity (i.e. select for studies which have series containing both values)
832+
# That cannot be performed here, as this is only a clause builder
833833
logger.warning("[WARNING] Multiple-value AND clauses require an intersection statement!")
834-
# Simple array param
835-
query_param['parameterType']['type'] = "ARRAY"
836-
query_param['parameterType']['arrayType'] = {
837-
'type': parameter_type
838-
}
839-
query_param['parameterValue'] = {
840-
'arrayValues': [{'value': x.lower() if parameter_type == 'STRING' else x} for x in values]}
841-
842-
clause_base = "%s IN UNNEST(@{})" % ("LOWER({}{})" if parameter_type == "STRING" else "{}{}")
843-
filter_string += clause_base.format('' if not field_prefix else field_prefix, attr,
844-
param_name)
834+
else:
835+
# Simple array param
836+
query_param['parameterType']['type'] = "ARRAY"
837+
query_param['parameterType']['arrayType'] = {
838+
'type': parameter_type
839+
}
840+
query_param['parameterValue'] = {
841+
'arrayValues': [{'value': x.lower() if parameter_type == 'STRING' else x} for x in values]}
842+
843+
clause_base = "%s IN UNNEST(@{})" % ("LOWER({}{})" if parameter_type == "STRING" else "{}{}")
844+
filter_string += clause_base.format('' if not field_prefix else field_prefix, attr,
845+
param_name)
845846

846847
if with_count_toggle:
847848
filter_string = "({}) OR @{}_filtering = 'not_filtering'".format(filter_string, param_name)

0 commit comments

Comments
 (0)