[Groonga-commit] groonga/groonga at 9f849a0 [master] Use index for nonexistent reference column value

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Tue Apr 7 22:53:33 JST 2015


Kouhei Sutou	2015-04-07 22:53:33 +0900 (Tue, 07 Apr 2015)

  New Revision: 9f849a07b21960029ce239dd3a584f58a4f76e15
  https://github.com/groonga/groonga/commit/9f849a07b21960029ce239dd3a584f58a4f76e15

  Message:
    Use index for nonexistent reference column value

  Added files:
    test/command/suite/select/index/equal/nonexistent_record.expected
    test/command/suite/select/index/equal/nonexistent_record.test
  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+2 -1)
===================================================================
--- lib/expr.c    2015-04-07 21:59:08 +0900 (f7d13aa)
+++ lib/expr.c    2015-04-07 22:53:33 +0900 (5068d9e)
@@ -728,7 +728,8 @@ grn_expr_append_obj_resolve_const(grn_ctx *ctx,
   grn_obj dest;
 
   GRN_OBJ_INIT(&dest, GRN_BULK, 0, to_domain);
-  if (!grn_obj_cast(ctx, obj, &dest, GRN_FALSE)) {
+  if (!grn_obj_cast(ctx, obj, &dest, GRN_FALSE) &&
+      GRN_BULK_VSIZE(&dest) > 0) {
     grn_obj_reinit(ctx, obj, to_domain, 0);
     grn_bulk_write(ctx, obj, GRN_BULK_HEAD(&dest), GRN_BULK_VSIZE(&dest));
   }

  Added: test/command/suite/select/index/equal/nonexistent_record.expected (+16 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/index/equal/nonexistent_record.expected    2015-04-07 22:53:33 +0900 (6b13185)
@@ -0,0 +1,16 @@
+table_create Tags TABLE_PAT_KEY ShortText
+[[0,0.0,0.0],true]
+table_create Bookmarks TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Bookmarks tag COLUMN_SCALAR Tags
+[[0,0.0,0.0],true]
+column_create Tags index COLUMN_INDEX Bookmarks tag
+[[0,0.0,0.0],true]
+load --table Bookmarks
+[
+{"_key": "http://groonga.org/", "tag": "groonga"},
+{"_key": "http://mroonga.org/", "tag": ""}
+]
+[[0,0.0,0.0],2]
+select Bookmarks --query 'tag:\"nonexistent\"'
+[[0,0.0,0.0],[[[0],[["_id","UInt32"],["_key","ShortText"],["tag","Tags"]]]]]

  Added: test/command/suite/select/index/equal/nonexistent_record.test (+14 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/index/equal/nonexistent_record.test    2015-04-07 22:53:33 +0900 (386e01a)
@@ -0,0 +1,14 @@
+table_create Tags TABLE_PAT_KEY ShortText
+
+table_create Bookmarks TABLE_HASH_KEY ShortText
+column_create Bookmarks tag COLUMN_SCALAR Tags
+
+column_create Tags index COLUMN_INDEX Bookmarks tag
+
+load --table Bookmarks
+[
+{"_key": "http://groonga.org/", "tag": "groonga"},
+{"_key": "http://mroonga.org/", "tag": ""}
+]
+
+select Bookmarks --query 'tag:\"nonexistent\"'
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index