[Groonga-commit] groonga/groonga at a8b3c9c [master] vector_slice: fix a bug that no length always mean "1" length

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 18 22:42:09 JST 2016


Kouhei Sutou	2016-07-18 22:42:09 +0900 (Mon, 18 Jul 2016)

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

  Message:
    vector_slice: fix a bug that no length always mean "1" length

  Modified files:
    plugins/functions/vector.c
    test/command/suite/select/function/vector/vector_slice/no_length.expected
    test/command/suite/select/function/vector/vector_slice/no_length.test

  Modified: plugins/functions/vector.c (+1 -3)
===================================================================
--- plugins/functions/vector.c    2016-07-18 22:25:57 +0900 (f54dbf2)
+++ plugins/functions/vector.c    2016-07-18 22:42:09 +0900 (d5b81e6)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2015 Brazil
+  Copyright(C) 2015-2016 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -94,8 +94,6 @@ func_vector_slice(grn_ctx *ctx, int n_args, grn_obj **args,
   from_raw = args[1];
   if (n_args == 3) {
     length_raw = args[2];
-  } else {
-    length = 1;
   }
   switch (target->header.type) {
   case GRN_VECTOR :

  Modified: test/command/suite/select/function/vector/vector_slice/no_length.expected (+9 -6)
===================================================================
--- test/command/suite/select/function/vector/vector_slice/no_length.expected    2016-07-18 22:25:57 +0900 (8795ce1)
+++ test/command/suite/select/function/vector/vector_slice/no_length.expected    2016-07-18 22:42:09 +0900 (9aac5bc)
@@ -6,12 +6,12 @@ column_create Memos tags COLUMN_VECTOR ShortText
 [[0,0.0,0.0],true]
 load --table Memos
 [
-{"_key": "Groonga", "tags": ["Groonga"]},
-{"_key": "Rroonga", "tags": ["Groonga", "Ruby"]},
+{"_key": "Groonga", "tags": ["Groonga", "Full text search"]},
+{"_key": "Rroonga", "tags": ["Groonga", "Full text search", "Ruby"]},
 {"_key": "Nothing"}
 ]
 [[0,0.0,0.0],3]
-select Memos   --output_columns 'tags, vector_slice(tags, 0)'
+select Memos   --output_columns 'tags, vector_slice(tags, 1)'
 [
   [
     0,
@@ -35,19 +35,22 @@ select Memos   --output_columns 'tags, vector_slice(tags, 0)'
       ],
       [
         [
-          "Groonga"
+          "Groonga",
+          "Full text search"
         ],
         [
-          "Groonga"
+          "Full text search"
         ]
       ],
       [
         [
           "Groonga",
+          "Full text search",
           "Ruby"
         ],
         [
-          "Groonga"
+          "Full text search",
+          "Ruby"
         ]
       ],
       [

  Modified: test/command/suite/select/function/vector/vector_slice/no_length.test (+3 -3)
===================================================================
--- test/command/suite/select/function/vector/vector_slice/no_length.test    2016-07-18 22:25:57 +0900 (8a65c75)
+++ test/command/suite/select/function/vector/vector_slice/no_length.test    2016-07-18 22:42:09 +0900 (a7be8eb)
@@ -5,10 +5,10 @@ column_create Memos tags COLUMN_VECTOR ShortText
 
 load --table Memos
 [
-{"_key": "Groonga", "tags": ["Groonga"]},
-{"_key": "Rroonga", "tags": ["Groonga", "Ruby"]},
+{"_key": "Groonga", "tags": ["Groonga", "Full text search"]},
+{"_key": "Rroonga", "tags": ["Groonga", "Full text search", "Ruby"]},
 {"_key": "Nothing"}
 ]
 
 select Memos \
-  --output_columns 'tags, vector_slice(tags, 0)'
+  --output_columns 'tags, vector_slice(tags, 1)'
-------------- next part --------------
HTML����������������������������...
下载 



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