[Groonga-commit] groonga/groonga at 814dbbc [master] Require "_value." for accessing record value in grouped table

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Nov 18 23:59:37 JST 2014


Kouhei Sutou	2014-11-18 23:59:37 +0900 (Tue, 18 Nov 2014)

  New Revision: 814dbbc090ebc18c20b1931ba3fbc01daabb5675
  https://github.com/groonga/groonga/commit/814dbbc090ebc18c20b1931ba3fbc01daabb5675

  Message:
    Require "_value." for accessing record value in grouped table
    
    Because no "_value." means that it accesses drilldowned referenced
    record's column value. It's confused that no "_value." means that "it
    accesses drilldowned referenced record's column value" OR "it accesses
    record value in grouped table".
    
    So we require "_value." for "accessing record value in grouped table".

  Modified files:
    lib/db.c
    test/command/suite/select/drilldown/labeled/filtered/multiple.expected
    test/command/suite/select/drilldown/labeled/filtered/multiple.test
    test/command/suite/select/drilldown/labeled/keys/multiple.expected
    test/command/suite/select/drilldown/labeled/keys/multiple.test

  Modified: lib/db.c (+12 -22)
===================================================================
--- lib/db.c    2014-11-18 22:58:48 +0900 (ef75f22)
+++ lib/db.c    2014-11-18 23:59:37 +0900 (3825200)
@@ -4476,14 +4476,8 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
           (*rp)->action = GRN_ACCESSOR_GET_COLUMN_VALUE;
           break;
         } else {
-          grn_bool is_grouped_table;
           grn_id next_obj_id;
-          is_grouped_table = grn_table_is_grouped(ctx, obj);
-          if (is_grouped_table) {
-            next_obj_id = grn_obj_get_range(ctx, obj);
-          } else {
-            next_obj_id = obj->header.domain;
-          }
+          next_obj_id = obj->header.domain;
           if (!next_obj_id) {
             // ERR(GRN_INVALID_ARGUMENT, "no such column: <%s>", name);
             if (!is_chained) {
@@ -4500,22 +4494,18 @@ grn_obj_get_accessor(grn_ctx *ctx, grn_obj *obj, const char *name, unsigned int
             res = NULL;
             goto exit;
           }
-          if (is_grouped_table) {
-            (*rp)->action = GRN_ACCESSOR_GET_VALUE;
-          } else {
-            switch (obj->header.type) {
-            case GRN_TABLE_PAT_KEY :
-            case GRN_TABLE_DAT_KEY :
-            case GRN_TABLE_HASH_KEY :
-            case GRN_TABLE_NO_KEY :
-              (*rp)->action = GRN_ACCESSOR_GET_KEY;
+          switch (obj->header.type) {
+          case GRN_TABLE_PAT_KEY :
+          case GRN_TABLE_DAT_KEY :
+          case GRN_TABLE_HASH_KEY :
+          case GRN_TABLE_NO_KEY :
+            (*rp)->action = GRN_ACCESSOR_GET_KEY;
             break;
-            default :
-              /* lookup failed */
-              grn_obj_close(ctx, (grn_obj *)res);
-              res = NULL;
-              goto exit;
-            }
+          default :
+            /* lookup failed */
+            grn_obj_close(ctx, (grn_obj *)res);
+            res = NULL;
+            goto exit;
           }
         }
       }

  Modified: test/command/suite/select/drilldown/labeled/filtered/multiple.expected (+23 -21)
===================================================================
--- test/command/suite/select/drilldown/labeled/filtered/multiple.expected    2014-11-18 22:58:48 +0900 (ca9a4cb)
+++ test/command/suite/select/drilldown/labeled/filtered/multiple.expected    2014-11-18 23:59:37 +0900 (4679432)
@@ -9,13 +9,14 @@ column_create Memos date COLUMN_SCALAR Time
 load --table Memos
 [
 {"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
-{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"},
 {"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
 {"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Rroonga is good!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Rroonga!!!!!!!!!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
 {"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"}
 ]
-[[0,0.0,0.0],5]
-select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag].output_columns tag,date,_nsubrecs
+[[0,0.0,0.0],6]
+select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag].output_columns _value.tag,_value.date,_nsubrecs   --drilldown[tag].sortby _nsubrecs
 [
   [
     0,
@@ -25,7 +26,7 @@ select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag]
   [
     [
       [
-        5
+        6
       ],
       [
         [
@@ -53,24 +54,30 @@ select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag]
       ],
       [
         2,
-        "Mroonga is fast!",
+        "Groonga sticker!",
         1416063600.0,
-        "Mroonga"
+        "Groonga"
       ],
       [
         3,
-        "Groonga sticker!",
-        1416063600.0,
-        "Groonga"
+        "Rroonga is fast!",
+        1416150000.0,
+        "Rroonga"
       ],
       [
         4,
-        "Rroonga is fast!",
+        "Rroonga is good!",
         1416150000.0,
         "Rroonga"
       ],
       [
         5,
+        "Rroonga!!!!!!!!!",
+        1416150000.0,
+        "Rroonga"
+      ],
+      [
+        6,
         "Groonga is good!",
         1416150000.0,
         "Groonga"
@@ -79,7 +86,7 @@ select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag]
     {
       "tag": [
         [
-          4
+          3
         ],
         [
           [
@@ -97,23 +104,18 @@ select Memos   --filter true   --drilldown[tag].keys tag,date   --drilldown[tag]
         ],
         [
           "Groonga",
-          1416063600.0,
-          2
+          1416150000.0,
+          1
         ],
         [
-          "Mroonga",
+          "Groonga",
           1416063600.0,
-          1
+          2
         ],
         [
           "Rroonga",
           1416150000.0,
-          1
-        ],
-        [
-          "Groonga",
-          1416150000.0,
-          1
+          3
         ]
       ]
     }

  Modified: test/command/suite/select/drilldown/labeled/filtered/multiple.test (+4 -2)
===================================================================
--- test/command/suite/select/drilldown/labeled/filtered/multiple.test    2014-11-18 22:58:48 +0900 (5ffe1bd)
+++ test/command/suite/select/drilldown/labeled/filtered/multiple.test    2014-11-18 23:59:37 +0900 (7cd1a7b)
@@ -7,13 +7,15 @@ column_create Memos date COLUMN_SCALAR Time
 load --table Memos
 [
 {"_key": "Groonga is fast!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
-{"_key": "Mroonga is fast!", "tag": "Mroonga", "date": "2014-11-16 00:00:00"},
 {"_key": "Groonga sticker!", "tag": "Groonga", "date": "2014-11-16 00:00:00"},
 {"_key": "Rroonga is fast!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Rroonga is good!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
+{"_key": "Rroonga!!!!!!!!!", "tag": "Rroonga", "date": "2014-11-17 00:00:00"},
 {"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"}
 ]
 
 select Memos \
   --filter true \
   --drilldown[tag].keys tag,date \
-  --drilldown[tag].output_columns tag,date,_nsubrecs
+  --drilldown[tag].output_columns _value.tag,_value.date,_nsubrecs \
+  --drilldown[tag].sortby _nsubrecs

  Modified: test/command/suite/select/drilldown/labeled/keys/multiple.expected (+1 -1)
===================================================================
--- test/command/suite/select/drilldown/labeled/keys/multiple.expected    2014-11-18 22:58:48 +0900 (4900e88)
+++ test/command/suite/select/drilldown/labeled/keys/multiple.expected    2014-11-18 23:59:37 +0900 (862ac7c)
@@ -15,7 +15,7 @@ load --table Memos
 {"_key": "Groonga is good!", "tag": "Groonga", "date": "2014-11-17 00:00:00"}
 ]
 [[0,0.0,0.0],5]
-select Memos   --drilldown[tag].keys tag,date   --drilldown[tag].output_columns tag,date,_nsubrecs
+select Memos   --drilldown[tag].keys tag,date   --drilldown[tag].output_columns _value.tag,_value.date,_nsubrecs
 [
   [
     0,

  Modified: test/command/suite/select/drilldown/labeled/keys/multiple.test (+1 -1)
===================================================================
--- test/command/suite/select/drilldown/labeled/keys/multiple.test    2014-11-18 22:58:48 +0900 (21d4c92)
+++ test/command/suite/select/drilldown/labeled/keys/multiple.test    2014-11-18 23:59:37 +0900 (3495239)
@@ -15,4 +15,4 @@ load --table Memos
 
 select Memos \
   --drilldown[tag].keys tag,date \
-  --drilldown[tag].output_columns tag,date,_nsubrecs
+  --drilldown[tag].output_columns _value.tag,_value.date,_nsubrecs
-------------- next part --------------
HTML����������������������������...
Download 



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