You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FilterPolicy.MERGE resolves a repeated field differently when both filters are AND #13208
Under FilterPolicy.MERGE, when the init and runtime filters constrain the same field, the result depends on how the filters are wrapped rather than on what they say.
If either side is a bare comparison filter, the runtime condition replaces the init condition on that field, and a warning is logged. This matches the docstring of FilterPolicy.MERGE: "Runtime filters are merged with init filters, with runtime filters overwriting init values."
If both sides are AND logical filters, combine_two_logical_filters concatenates the conditions. Both conditions on the field are kept, so the result is their intersection, and no warning is logged.
With the same intent (init meta.lang == "en", runtime meta.lang == "de"), three of the four shapes return the German document, and the fourth returns nothing without logging anything.
['de'] # init comparison + runtime AND (warning: init filter ignored)
['de'] # init AND + runtime comparison (warning: runtime filter overwrites)
['de'] # init comparison + runtime comparison (warning)
[] # init AND + runtime AND (no warning)
Expected behavior
I'm not sure which behavior you want here, so I'm asking before proposing a change. #12816 settled that two AND filters should both narrow the result. That reading conflicts with "runtime filters overwriting init values" and with the three comparison paths. Two consistent options:
In combine_two_logical_filters, when both are AND, drop init conditions whose field also appears in the runtime conditions, and log the same warning as combine_runtime_comparison_and_init_logical_filters.
Keep the intersection, and at least log a warning when the two AND filters share a field, so an empty result is not silent. The FilterPolicy.MERGE docstring would also need to be updated.
Activity
fix: make MERGE resolve same-field AND filters consistently