Bug #5304

[API] filters incorrectly exclude results for records with null value in filtered field

Added by Ward Vandewege almost 6 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Radhika Chippada
Category:
API
Target version:
Start date:
03/10/2015
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
0.5

Description

There appears to be a bug in our filter code on the API side, where a call like this:

arv group list --filters='[["group_class", "!=", "project"]]'

does not return any groups where group_class is set to null. Of course group_class should probably not be set to null, but that is irrelevant; the filter should not exclude those records from this call.

The workbench code uses a functionally identical API call to show the list of groups on the sharing screen.


Subtasks

Task #5430: Review branch: 5304-include-nulls-when-notequal-filterResolvedRadhika Chippada


Related issues

Related to Arvados - Bug #3819: [Workbench] It's not possible to share a project with the 'All Users' groupResolved

Associated revisions

Revision 83c0e051
Added by Radhika Chippada over 5 years ago

closes #5304
Merge branch '5304-include-nulls-when-notequal-filter'

History

#1 Updated by Ward Vandewege almost 6 years ago

  • Description updated (diff)

#2 Updated by Ward Vandewege almost 6 years ago

  • Description updated (diff)

#3 Updated by Ward Vandewege almost 6 years ago

  • Description updated (diff)

#4 Updated by Brett Smith almost 6 years ago

  • Category set to API

I note this code in record_filters.rb:

           if operator == 'not in' and not operand.include?(nil)
              # explicitly allow NULL
              cond_out[-1] = "(#{cond_out[-1]} OR #{ar_table_name}.#{attr} IS NULL)" 
            end

This makes me think we need similar logic for equality operators.

#5 Updated by Tom Clegg over 5 years ago

Agreed. The SQL way of thinking (NULL == 1 is false, and NULL <> 1 is also false) seems confusing enough to be worth explicitly breaking away from.

#6 Updated by Radhika Chippada over 5 years ago

  • Status changed from New to In Progress
  • Assigned To set to Radhika Chippada
  • Target version changed from Bug Triage to 2015-03-11 sprint

#7 Updated by Brett Smith over 5 years ago

Commit:c68037a looks great. Go ahead and merge. Thanks.

#8 Updated by Radhika Chippada over 5 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:83c0e051c3611b021d7f0e2ea58d10c67c92698d.

#9 Updated by Ward Vandewege over 5 years ago

  • Story points set to 0.5

Also available in: Atom PDF