[Groonga-commit] groonga/groonga at b289557 [master] Fix a bug that "function(column_with_index) == 29" ignores function()

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jan 31 16:36:16 JST 2016


Kouhei Sutou	2016-01-31 16:36:16 +0900 (Sun, 31 Jan 2016)

  New Revision: b289557038feb79844dc344b3c81980698535227
  https://github.com/groonga/groonga/commit/b289557038feb79844dc344b3c81980698535227

  Message:
    Fix a bug that "function(column_with_index) == 29" ignores function()
    
    [groonga-dev,03884]
    
    Reported by Naoya Murakami. Thanks!!!

  Added files:
    test/command/suite/select/filter/function/with_index.expected
    test/command/suite/select/filter/function/with_index.test
  Modified files:
    lib/expr.c
    lib/mrb/scripts/scan_info_data.rb

  Modified: lib/expr.c (+2 -0)
===================================================================
--- lib/expr.c    2016-01-28 17:32:22 +0900 (2687d02)
+++ lib/expr.c    2016-01-31 16:36:16 +0900 (ee2d5a7)
@@ -4371,6 +4371,8 @@ scan_info_build_match(grn_ctx *ctx, scan_info *si)
       scan_info_build_match_expr(ctx, si, (grn_expr *)(*p));
     } else if ((*p)->header.type == GRN_COLUMN_INDEX) {
       scan_info_put_index(ctx, si, *p, 0, 1, NULL, NULL, 0);
+    } else if (grn_obj_is_proc(ctx, *p)) {
+      break;
     } else if (GRN_DB_OBJP(*p)) {
       grn_index_datum index_datum;
       unsigned int n_index_data;

  Modified: lib/mrb/scripts/scan_info_data.rb (+2 -0)
===================================================================
--- lib/mrb/scripts/scan_info_data.rb    2016-01-28 17:32:22 +0900 (c1d907b)
+++ lib/mrb/scripts/scan_info_data.rb    2016-01-31 16:36:16 +0900 (7f22532)
@@ -100,6 +100,8 @@ module Groonga
           match_resolve_index_index_column(arg)
         when Indexable
           match_resolve_index_indexable(arg)
+        when Procedure
+          break
         else
           self.query = arg
         end

  Added: test/command/suite/select/filter/function/with_index.expected (+18 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/function/with_index.expected    2016-01-31 16:36:16 +0900 (77640cb)
@@ -0,0 +1,18 @@
+plugin_register functions/vector
+[[0,0.0,0.0],true]
+table_create Users TABLE_NO_KEY
+[[0,0.0,0.0],true]
+column_create Users names COLUMN_VECTOR ShortText
+[[0,0.0,0.0],true]
+table_create Names TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Names users COLUMN_INDEX Users names
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"names": ["Alice", "Bob"]},
+{"names": ["Tom"]}
+]
+[[0,0.0,0.0],2]
+select Users --filter 'vector_size(names) == 1'
+[[0,0.0,0.0],[[[1],[["_id","UInt32"],["names","ShortText"]],[2,["Tom"]]]]]

  Added: test/command/suite/select/filter/function/with_index.test (+14 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/filter/function/with_index.test    2016-01-31 16:36:16 +0900 (7e5951a)
@@ -0,0 +1,14 @@
+plugin_register functions/vector
+table_create Users TABLE_NO_KEY
+column_create Users names COLUMN_VECTOR ShortText
+
+table_create Names TABLE_PAT_KEY ShortText
+column_create Names users COLUMN_INDEX Users names
+
+load --table Users
+[
+{"names": ["Alice", "Bob"]},
+{"names": ["Tom"]}
+]
+
+select Users --filter 'vector_size(names) == 1'
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index