[Groonga-commit] groonga/groonga at 726adb8 [master] select: add error check for invalid drilldown parameter

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Feb 14 21:30:38 JST 2015


Kouhei Sutou	2015-02-14 21:30:38 +0900 (Sat, 14 Feb 2015)

  New Revision: 726adb8da2412ce839cb5946c3f45573908a5a37
  https://github.com/groonga/groonga/commit/726adb8da2412ce839cb5946c3f45573908a5a37

  Message:
    select: add error check for invalid drilldown parameter

  Added files:
    test/command/suite/select/drilldown/plain/invalid/too_large_type.expected
    test/command/suite/select/drilldown/plain/invalid/too_large_type.test
  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+3 -0)
===================================================================
--- lib/proc.c    2015-02-13 22:22:02 +0900 (8ebdfd4)
+++ lib/proc.c    2015-02-14 21:30:38 +0900 (64f3288)
@@ -691,6 +691,9 @@ grn_select_drilldown(grn_ctx *ctx, grn_obj *table,
     }
 
     grn_table_group(ctx, table, &keys[i], 1, &g, 1);
+    if (ctx->rc != GRN_SUCCESS) {
+      break;
+    }
     n_hits = grn_table_size(ctx, g.table);
 
     offset = drilldown->offset;

  Added: test/command/suite/select/drilldown/plain/invalid/too_large_type.expected (+75 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/invalid/too_large_type.expected    2015-02-14 21:30:38 +0900 (04f9262)
@@ -0,0 +1,75 @@
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+column_create Memos tag1 COLUMN_SCALAR Text
+[[0,0.0,0.0],true]
+column_create Memos tag2 COLUMN_SCALAR ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tag1": "Groonga"},
+{"_key": "Mroonga is fast!", "tag1": "Mroonga", "tag2": "Groonga"},
+{"_key": "Groonga sticker!", "tag1": "Groonga"},
+{"_key": "Rroonga is fast!", "tag1": "Rroonga", "tag2": "Groonga"}
+]
+[[0,0.0,0.0],4]
+select Memos --drilldown tag1,tag2
+[
+  [
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "[table][create] key size too big: <> <Text>(65536) (max:4096)"
+  ],
+  [
+    [
+      [
+        4
+      ],
+      [
+        [
+          "_id",
+          "UInt32"
+        ],
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "tag1",
+          "Text"
+        ],
+        [
+          "tag2",
+          "ShortText"
+        ]
+      ],
+      [
+        1,
+        "Groonga is fast!",
+        "Groonga",
+        ""
+      ],
+      [
+        2,
+        "Mroonga is fast!",
+        "Mroonga",
+        "Groonga"
+      ],
+      [
+        3,
+        "Groonga sticker!",
+        "Groonga",
+        ""
+      ],
+      [
+        4,
+        "Rroonga is fast!",
+        "Rroonga",
+        "Groonga"
+      ]
+    ]
+  ]
+]
+#|e| [table][create] key size too big: <> <Text>(65536) (max:4096)

  Added: test/command/suite/select/drilldown/plain/invalid/too_large_type.test (+13 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/drilldown/plain/invalid/too_large_type.test    2015-02-14 21:30:38 +0900 (ed2107f)
@@ -0,0 +1,13 @@
+table_create Memos TABLE_HASH_KEY ShortText
+column_create Memos tag1 COLUMN_SCALAR Text
+column_create Memos tag2 COLUMN_SCALAR ShortText
+
+load --table Memos
+[
+{"_key": "Groonga is fast!", "tag1": "Groonga"},
+{"_key": "Mroonga is fast!", "tag1": "Mroonga", "tag2": "Groonga"},
+{"_key": "Groonga sticker!", "tag1": "Groonga"},
+{"_key": "Rroonga is fast!", "tag1": "Rroonga", "tag2": "Groonga"}
+]
+
+select Memos --drilldown tag1,tag2
-------------- next part --------------
HTML����������������������������...
다운로드 



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