[ARVADOS] created: 1.3.0-2121-g1d922bf21

Git user git at public.arvados.org
Wed Feb 19 18:07:29 UTC 2020


        at  1d922bf219f74efcd5fda01ed127f7ccae0790c4 (commit)


commit 1d922bf219f74efcd5fda01ed127f7ccae0790c4
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Feb 19 15:06:25 2020 -0300

    15781: Adds test proving that 'contains' does case-sensitive matching.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 84c355993..1581039bb 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -1000,7 +1000,7 @@ collection_with_list_prop_even:
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
   name: collection with list property with even values
   properties:
-    listprop: [elem2, 4, elem6]
+    listprop: [elem2, 4, elem6, ELEM8]
 
 collection_with_listprop_elem1:
   uuid: zzzzz-4zz18-listpropelem1
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 738c18080..b30afd745 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -176,6 +176,8 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
    ['listprop', '=', 'elem1', [:collection_with_listprop_elem1], [:collection_with_list_prop_odd]],
    ['listprop', 'contains', 5, [:collection_with_list_prop_odd], [:collection_with_list_prop_even, :collection_with_listprop_elem1]],
    ['listprop', 'contains', 'elem2', [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],
+   ['listprop', 'contains', 'ELEM2', [], [:collection_with_list_prop_even]],
+   ['listprop', 'contains', 'elem8', [], [:collection_with_list_prop_even]],
    ['listprop', 'contains', 4, [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],
   ].each do |prop, op, opr, inc, ex|
     test "jsonb filter properties.#{prop} #{op} #{opr})" do

commit 8141f4c40e11415b0b37ef30f351364f50c7760e
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Wed Feb 12 15:59:11 2020 -0300

    15781: Bump API revision number to signal new feature.
    
    The feature would be the 'contains' filter operator. Workbench2 should
    not try to use it on older Arvados clusters.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/app/controllers/arvados/v1/schema_controller.rb b/services/api/app/controllers/arvados/v1/schema_controller.rb
index aee5d1f95..5c2234101 100644
--- a/services/api/app/controllers/arvados/v1/schema_controller.rb
+++ b/services/api/app/controllers/arvados/v1/schema_controller.rb
@@ -36,7 +36,7 @@ class Arvados::V1::SchemaController < ApplicationController
         # format is YYYYMMDD, must be fixed with (needs to be linearly
         # sortable), updated manually, may be used by clients to
         # determine availability of API server features.
-        revision: "20190926",
+        revision: "20200212",
         source_version: AppVersion.hash,
         sourceVersion: AppVersion.hash, # source_version should be deprecated in the future
         packageVersion: AppVersion.package_version,

commit dd7da09fe29a98b2af2c3d8fd428d47e0d1e5d74
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Mon Feb 10 19:29:35 2020 -0300

    15718: Makes documentation clearer.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/doc/api/methods.html.textile.liquid b/doc/api/methods.html.textile.liquid
index b10af8d6c..90af08ca5 100644
--- a/doc/api/methods.html.textile.liquid
+++ b/doc/api/methods.html.textile.liquid
@@ -130,7 +130,7 @@ table(table table-bordered table-condensed).
 |@like@, @ilike@|string|SQL pattern match, single character match is @_@ and wildcard is @%@, ilike is case-insensitive|@["properties.my_subproperty", "like", "d00220fb%"]@|
 |@in@, @not in@|array of strings|Set membership|@["properties.my_subproperty", "in", ["fizz", "buzz"]]@|
 |@exists@|boolean|Test if a subproperty is present or not (determined by operand).|@["properties.my_subproperty", "exists", true]@|
-|@contains@|string, number|Test if a value is present on a subproperty either by exact match or set membership.|@["properties.list_property","contains","some_value"]@|
+|@contains@|string, number|Filter where subproperty has a value either by exact match or value is element of subproperty list.|@["foo", "contains", "bar"]@ will find both @{"foo": "bar"}@ and @{"foo": ["bar", "baz"]}@.|
 
 Note that exclusion filters @!=@ and @not in@ will return records for which the property is not defined at all.  To restrict filtering to records on which the subproperty is defined, combine with an @exists@ filter.
 

commit 8a88ceb33a00a83708fab9a0e3f5ad5e95bac2a6
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 30 12:21:19 2020 -0300

    15781: Adds test confirming subprop '=' filter doesn't work on array elements.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 2484127b2..738c18080 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -173,6 +173,7 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
    ['prop2', '>=', 1, [:collection_with_prop2_1, :collection_with_prop2_5], []],
    ['<http://schema.org/example>', '=', "value1", [:collection_with_uri_prop], []],
    ['listprop', 'contains', 'elem1', [:collection_with_list_prop_odd, :collection_with_listprop_elem1], [:collection_with_list_prop_even]],
+   ['listprop', '=', 'elem1', [:collection_with_listprop_elem1], [:collection_with_list_prop_odd]],
    ['listprop', 'contains', 5, [:collection_with_list_prop_odd], [:collection_with_list_prop_even, :collection_with_listprop_elem1]],
    ['listprop', 'contains', 'elem2', [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],
    ['listprop', 'contains', 4, [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],

commit f497a5625ccfc1c359e17fa88ac6edb80181244d
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 30 11:58:58 2020 -0300

    15781: Adds documentation on 'contains' filter.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/doc/api/methods.html.textile.liquid b/doc/api/methods.html.textile.liquid
index 175463c32..b10af8d6c 100644
--- a/doc/api/methods.html.textile.liquid
+++ b/doc/api/methods.html.textile.liquid
@@ -130,6 +130,7 @@ table(table table-bordered table-condensed).
 |@like@, @ilike@|string|SQL pattern match, single character match is @_@ and wildcard is @%@, ilike is case-insensitive|@["properties.my_subproperty", "like", "d00220fb%"]@|
 |@in@, @not in@|array of strings|Set membership|@["properties.my_subproperty", "in", ["fizz", "buzz"]]@|
 |@exists@|boolean|Test if a subproperty is present or not (determined by operand).|@["properties.my_subproperty", "exists", true]@|
+|@contains@|string, number|Test if a value is present on a subproperty either by exact match or set membership.|@["properties.list_property","contains","some_value"]@|
 
 Note that exclusion filters @!=@ and @not in@ will return records for which the property is not defined at all.  To restrict filtering to records on which the subproperty is defined, combine with an @exists@ filter.
 

commit 1fa3a92ed6100aac7ac8af68095d199effeea344
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 30 11:55:18 2020 -0300

    15781: Adds support for exact match on 'contains' filter.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index e059a6e70..5688ca614 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -141,7 +141,8 @@ module RecordFilters
             end
             param_out << proppath
           when 'contains'
-            cond_out << "#{attr_table_name}.#{attr} @> ?::jsonb"
+            cond_out << "#{attr_table_name}.#{attr} @> ?::jsonb OR #{attr_table_name}.#{attr} @> ?::jsonb"
+            param_out << SafeJSON.dump({proppath => operand})
             param_out << SafeJSON.dump({proppath => [operand]})
           else
             raise ArgumentError.new("Invalid operator for subproperty search '#{operator}'")
diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index ff01de150..84c355993 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -1002,6 +1002,21 @@ collection_with_list_prop_even:
   properties:
     listprop: [elem2, 4, elem6]
 
+collection_with_listprop_elem1:
+  uuid: zzzzz-4zz18-listpropelem1
+  current_version_uuid: zzzzz-4zz18-listpropelem1
+  portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2015-02-13T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2015-02-13T17:22:54Z
+  updated_at: 2015-02-13T17:22:54Z
+  manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+  name: collection with list property with string value
+  properties:
+    listprop: elem1
+
 collection_with_uri_prop:
   uuid: zzzzz-4zz18-withuripropval1
   current_version_uuid: zzzzz-4zz18-withuripropval1
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index 08ca71f60..2484127b2 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -172,10 +172,10 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
    ['prop2', '<=', 5, [:collection_with_prop2_1, :collection_with_prop2_5], []],
    ['prop2', '>=', 1, [:collection_with_prop2_1, :collection_with_prop2_5], []],
    ['<http://schema.org/example>', '=', "value1", [:collection_with_uri_prop], []],
-   ['listprop', 'contains', 'elem1', [:collection_with_list_prop_odd], [:collection_with_list_prop_even]],
-   ['listprop', 'contains', 5, [:collection_with_list_prop_odd], [:collection_with_list_prop_even]],
-   ['listprop', 'contains', 'elem2', [:collection_with_list_prop_even], [:collection_with_list_prop_odd]],
-   ['listprop', 'contains', 4, [:collection_with_list_prop_even], [:collection_with_list_prop_odd]],
+   ['listprop', 'contains', 'elem1', [:collection_with_list_prop_odd, :collection_with_listprop_elem1], [:collection_with_list_prop_even]],
+   ['listprop', 'contains', 5, [:collection_with_list_prop_odd], [:collection_with_list_prop_even, :collection_with_listprop_elem1]],
+   ['listprop', 'contains', 'elem2', [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],
+   ['listprop', 'contains', 4, [:collection_with_list_prop_even], [:collection_with_list_prop_odd, :collection_with_listprop_elem1]],
   ].each do |prop, op, opr, inc, ex|
     test "jsonb filter properties.#{prop} #{op} #{opr})" do
       @controller = Arvados::V1::CollectionsController.new

commit fb5491f94ace7bbba4666a0a2aa719acd7cbfb7b
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 30 11:05:32 2020 -0300

    15781: Adds support for JSONB 'contains' filter.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index 994e85031..e059a6e70 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -19,7 +19,7 @@ module RecordFilters
   # +model_class+    subclass of ActiveRecord being filtered
   #
   # Output:
-  # Hash with two keys:
+  # Hash with the following keys:
   # :cond_out  array of SQL fragments for each filter expression
   # :param_out array of values for parameter substitution in cond_out
   # :joins     array of joins: either [] or ["JOIN containers ON ..."]
@@ -140,6 +140,9 @@ module RecordFilters
               raise ArgumentError.new("Invalid operand '#{operand}' for '#{operator}' must be true or false")
             end
             param_out << proppath
+          when 'contains'
+            cond_out << "#{attr_table_name}.#{attr} @> ?::jsonb"
+            param_out << SafeJSON.dump({proppath => [operand]})
           else
             raise ArgumentError.new("Invalid operator for subproperty search '#{operator}'")
           end

commit 1672501e88972c94bdcab5f681229eb9e9f4a4f6
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Thu Jan 30 11:04:54 2020 -0300

    15781: Adds tests for new JSONB filter 'contains'
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/services/api/test/fixtures/collections.yml b/services/api/test/fixtures/collections.yml
index 1503f6bc0..ff01de150 100644
--- a/services/api/test/fixtures/collections.yml
+++ b/services/api/test/fixtures/collections.yml
@@ -953,7 +953,7 @@ collection_with_prop2_1:
   modified_at: 2015-02-13T17:22:54Z
   updated_at: 2015-02-13T17:22:54Z
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
-  name: collection with prop1 1
+  name: collection with prop2 1
   properties:
     prop2: 1
 
@@ -968,10 +968,40 @@ collection_with_prop2_5:
   modified_at: 2015-02-13T17:22:54Z
   updated_at: 2015-02-13T17:22:54Z
   manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
-  name: collection with prop1 5
+  name: collection with prop2 5
   properties:
     prop2: 5
 
+collection_with_list_prop_odd:
+  uuid: zzzzz-4zz18-listpropertyodd
+  current_version_uuid: zzzzz-4zz18-listpropertyodd
+  portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2015-02-13T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2015-02-13T17:22:54Z
+  updated_at: 2015-02-13T17:22:54Z
+  manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+  name: collection with list property with odd values
+  properties:
+    listprop: [elem1, elem3, 5]
+
+collection_with_list_prop_even:
+  uuid: zzzzz-4zz18-listpropertyeven
+  current_version_uuid: zzzzz-4zz18-listpropertyeven
+  portable_data_hash: fa7aeb5140e2848d39b416daeef4ffc5+45
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2015-02-13T17:22:54Z
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-d9tiejq69daie8f
+  modified_at: 2015-02-13T17:22:54Z
+  updated_at: 2015-02-13T17:22:54Z
+  manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
+  name: collection with list property with even values
+  properties:
+    listprop: [elem2, 4, elem6]
+
 collection_with_uri_prop:
   uuid: zzzzz-4zz18-withuripropval1
   current_version_uuid: zzzzz-4zz18-withuripropval1
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
index d49fe7a3e..08ca71f60 100644
--- a/services/api/test/functional/arvados/v1/filters_test.rb
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -172,6 +172,10 @@ class Arvados::V1::FiltersTest < ActionController::TestCase
    ['prop2', '<=', 5, [:collection_with_prop2_1, :collection_with_prop2_5], []],
    ['prop2', '>=', 1, [:collection_with_prop2_1, :collection_with_prop2_5], []],
    ['<http://schema.org/example>', '=', "value1", [:collection_with_uri_prop], []],
+   ['listprop', 'contains', 'elem1', [:collection_with_list_prop_odd], [:collection_with_list_prop_even]],
+   ['listprop', 'contains', 5, [:collection_with_list_prop_odd], [:collection_with_list_prop_even]],
+   ['listprop', 'contains', 'elem2', [:collection_with_list_prop_even], [:collection_with_list_prop_odd]],
+   ['listprop', 'contains', 4, [:collection_with_list_prop_even], [:collection_with_list_prop_odd]],
   ].each do |prop, op, opr, inc, ex|
     test "jsonb filter properties.#{prop} #{op} #{opr})" do
       @controller = Arvados::V1::CollectionsController.new

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list