[Groonga-commit] groonga/groonga at 99f06db [master] select: report error instead of ignoring on invalid drilldown sort_keys

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jan 24 15:55:44 JST 2017


Kouhei Sutou	2017-01-24 15:55:44 +0900 (Tue, 24 Jan 2017)

  New Revision: 99f06db421aac306faf3feb850f5612b0e0890e7
  https://github.com/groonga/groonga/commit/99f06db421aac306faf3feb850f5612b0e0890e7

  Message:
    select: report error instead of ignoring on invalid drilldown sort_keys

  Modified files:
    lib/proc/proc_select.c
    test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/column.expected
    test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/sum.expected
    test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/with_valid_drilldown.expected

  Modified: lib/proc/proc_select.c (+6 -6)
===================================================================
--- lib/proc/proc_select.c    2017-01-24 15:47:35 +0900 (14d099e)
+++ lib/proc/proc_select.c    2017-01-24 15:55:44 +0900 (8adb3fe)
@@ -1939,9 +1939,7 @@ grn_select_output_slices(grn_ctx *ctx,
                                               slice->sort_keys.value,
                                               slice->sort_keys.length,
                                               slice->table, &n_sort_keys);
-      if (!sort_keys) {
-        GRN_PLUGIN_CLEAR_ERROR(ctx);
-      } else {
+      if (sort_keys) {
         grn_obj *sorted;
         sorted = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY,
                                   NULL, slice->table);
@@ -1962,6 +1960,8 @@ grn_select_output_slices(grn_ctx *ctx,
           grn_obj_unlink(ctx, sorted);
         }
         grn_table_sort_key_close(ctx, sort_keys, n_sort_keys);
+      } else {
+        succeeded = GRN_FALSE;
       }
     } else {
       data->output.formatter->slice_label(ctx, data, slice);
@@ -2526,9 +2526,7 @@ grn_select_output_drilldowns(grn_ctx *ctx,
                                               drilldown->sort_keys.value,
                                               drilldown->sort_keys.length,
                                               target_table, &n_sort_keys);
-      if (!sort_keys) {
-        GRN_PLUGIN_CLEAR_ERROR(ctx);
-      } else {
+      if (sort_keys) {
         grn_obj *sorted;
         sorted = grn_table_create(ctx, NULL, 0, NULL, GRN_OBJ_TABLE_NO_KEY,
                                   NULL, target_table);
@@ -2549,6 +2547,8 @@ grn_select_output_drilldowns(grn_ctx *ctx,
           grn_obj_unlink(ctx, sorted);
         }
         grn_table_sort_key_close(ctx, sort_keys, n_sort_keys);
+      } else {
+        succeeded = GRN_FALSE;
       }
     } else {
       data->output.formatter->drilldown_label(ctx, data, drilldown);

  Modified: test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/column.expected (+6 -3)
===================================================================
--- test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/column.expected    2017-01-24 15:47:35 +0900 (fcd67f5)
+++ test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/column.expected    2017-01-24 15:55:44 +0900 (ad7d5a1)
@@ -17,9 +17,12 @@ load --table Memos
 select Memos   --drilldowns[tag].keys tag   --drilldowns[tag].output_columns _key   --drilldowns[tag].sort_keys noexistent
 [
   [
-    0,
-    0.0,
-    0.0
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "invalid sort key: <noexistent>: table:<(anonymous)> keys:<noexistent>"
   ],
   [
     [

  Modified: test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/sum.expected (+6 -3)
===================================================================
--- test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/sum.expected    2017-01-24 15:47:35 +0900 (8eee3c1)
+++ test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/sum.expected    2017-01-24 15:55:44 +0900 (f523a04)
@@ -13,9 +13,12 @@ load --table Items
 select Items   --drilldowns[tag].keys tag   --drilldowns[tag].sort_keys -_sum
 [
   [
-    0,
-    0.0,
-    0.0
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "invalid sort key: <_sum>: table:<(anonymous)> keys:<-_sum>"
   ],
   [
     [

  Modified: test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/with_valid_drilldown.expected (+6 -30)
===================================================================
--- test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/with_valid_drilldown.expected    2017-01-24 15:47:35 +0900 (00ab3c4)
+++ test/command/suite/select/drilldowns/sort_keys/invalid/nonexistent/with_valid_drilldown.expected    2017-01-24 15:55:44 +0900 (0784621)
@@ -17,9 +17,12 @@ load --table Memos
 select Memos   --drilldowns[tag].keys tag   --drilldowns[tag].output_columns _key   --drilldowns[tag].sort_keys noexistent   --drilldowns[tag2].keys tag
 [
   [
-    0,
-    0.0,
-    0.0
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "invalid sort key: <noexistent>: table:<(anonymous)> keys:<noexistent>"
   ],
   [
     [
@@ -70,33 +73,6 @@ select Memos   --drilldowns[tag].keys tag   --drilldowns[tag].output_columns _ke
       ]
     ],
     {
-      "tag2": [
-        [
-          3
-        ],
-        [
-          [
-            "_key",
-            "ShortText"
-          ],
-          [
-            "_nsubrecs",
-            "Int32"
-          ]
-        ],
-        [
-          "Groonga",
-          2
-        ],
-        [
-          "Mroonga",
-          1
-        ],
-        [
-          "Rroonga",
-          1
-        ]
-      ]
     }
   ]
 ]
-------------- next part --------------
HTML����������������������������...
Download 



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