[Groonga-commit] groonga/groonga at 423b681 [master] query: fix a bug that calling needless unlink

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Aug 12 11:49:59 JST 2015


Kouhei Sutou	2015-08-12 11:49:59 +0900 (Wed, 12 Aug 2015)

  New Revision: 423b68131c6f174f11e9da8a5bd6fe586f0b8d3a
  https://github.com/groonga/groonga/commit/423b68131c6f174f11e9da8a5bd6fe586f0b8d3a

  Message:
    query: fix a bug that calling needless unlink
    
    If the table is temporary table, the temporary table is freed. But the
    temporary table is still used.

  Added files:
    test/command/suite/select/scorer/function/query.expected
    test/command/suite/select/scorer/function/query.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+0 -4)
===================================================================
--- lib/proc.c    2015-08-12 11:48:22 +0900 (45cbe60)
+++ lib/proc.c    2015-08-12 11:49:59 +0900 (402d36f)
@@ -5118,10 +5118,6 @@ selector_to_function_data_fin(grn_ctx *ctx,
   if (data->records) {
     grn_obj_unlink(ctx, data->records);
   }
-
-  if (data->table) {
-    grn_obj_unlink(ctx, data->table);
-  }
 }
 
 static grn_rc

  Added: test/command/suite/select/scorer/function/query.expected (+15 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/scorer/function/query.expected    2015-08-12 11:49:59 +0900 (1b539f0)
@@ -0,0 +1,15 @@
+table_create Users TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Users name COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+table_create Terms TABLE_PAT_KEY ShortText   --default_tokenizer TokenBigram   --normalizer NormalizerAuto
+[[0,0.0,0.0],true]
+column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
+[[0,0.0,0.0],true]
+load --table Users
+[
+{"_key": "alice", "name": "Alice"}
+]
+[[0,0.0,0.0],1]
+select Users   --filter true   --scorer '_score = query("name", "Alice")'   --output_columns _key,_score
+[[0,0.0,0.0],[[[1],[["_key","ShortText"],["_score","Int32"]],["alice",0]]]]

  Added: test/command/suite/select/scorer/function/query.test (+17 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/scorer/function/query.test    2015-08-12 11:49:59 +0900 (261590a)
@@ -0,0 +1,17 @@
+table_create Users TABLE_HASH_KEY ShortText
+column_create Users name COLUMN_SCALAR ShortText
+
+table_create Terms TABLE_PAT_KEY ShortText \
+  --default_tokenizer TokenBigram \
+  --normalizer NormalizerAuto
+column_create Terms users_name COLUMN_INDEX|WITH_POSITION Users name
+
+load --table Users
+[
+{"_key": "alice", "name": "Alice"}
+]
+
+select Users \
+  --filter true \
+  --scorer '_score = query("name", "Alice")' \
+  --output_columns _key,_score
-------------- next part --------------
HTML����������������������������...
Download 



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