Kouhei Sutou 2018-11-27 14:38:03 +0900 (Tue, 27 Nov 2018) Revision: 9da876b4b5cb54db9cfed7cc70ade58c17c1a7c8 https://github.com/groonga/groonga/commit/9da876b4b5cb54db9cfed7cc70ade58c17c1a7c8 Message: select: stop to generate invalid JSON on slice output_columns error Added files: test/command/suite/select/slices/invalid/output_columns.expected test/command/suite/select/slices/invalid/output_columns.test Modified files: lib/proc/proc_select.c Modified: lib/proc/proc_select.c (+3 -0) =================================================================== --- lib/proc/proc_select.c 2018-11-27 14:04:03 +0900 (2b30d0016) +++ lib/proc/proc_select.c 2018-11-27 14:38:03 +0900 (d2cde577c) @@ -1,6 +1,7 @@ /* -*- c-basic-offset: 2 -*- */ /* Copyright(C) 2009-2018 Brazil + Copyright(C) 2018 Kouhei Sutou <kou****@clear*****> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -1176,6 +1177,8 @@ grn_proc_select_output_columns_open(grn_ctx *ctx, columns, columns_len, condition)) { + GRN_OUTPUT_RESULT_SET_OPEN(res, NULL, 0); + GRN_OUTPUT_RESULT_SET_CLOSE(res, NULL); return GRN_FALSE; } Added: test/command/suite/select/slices/invalid/output_columns.expected (+64 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/slices/invalid/output_columns.expected 2018-11-27 14:38:03 +0900 (46b5fbb84) @@ -0,0 +1,64 @@ +table_create Memos TABLE_HASH_KEY 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 memos_key COLUMN_INDEX|WITH_POSITION Memos _key +[[0,0.0,0.0],true] +load --table Memos +[ +{"_key": "Groonga is fast!"}, +{"_key": "Mroonga is fast!"}, +{"_key": "Groonga sticker!"}, +{"_key": "Rroonga is fast!"} +] +[[0,0.0,0.0],4] +select Memos --slices[groonga].match_columns '_key' --slices[groonga].query 'Groonga' --slices[groonga].output_columns ':' +[ + [ + [ + -63, + 0.0, + 0.0 + ], + "Syntax error: <|:|>" + ], + [ + [ + [ + 4 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ] + ], + [ + 1, + "Groonga is fast!" + ], + [ + 2, + "Mroonga is fast!" + ], + [ + 3, + "Groonga sticker!" + ], + [ + 4, + "Rroonga is fast!" + ] + ], + { + "groonga": [ + + ] + } + ] +] +#|e| Syntax error: <|:|> Added: test/command/suite/select/slices/invalid/output_columns.test (+19 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/slices/invalid/output_columns.test 2018-11-27 14:38:03 +0900 (889c7e647) @@ -0,0 +1,19 @@ +table_create Memos TABLE_HASH_KEY ShortText + +table_create Terms TABLE_PAT_KEY ShortText \ + --default_tokenizer TokenBigram \ + --normalizer NormalizerAuto +column_create Terms memos_key COLUMN_INDEX|WITH_POSITION Memos _key + +load --table Memos +[ +{"_key": "Groonga is fast!"}, +{"_key": "Mroonga is fast!"}, +{"_key": "Groonga sticker!"}, +{"_key": "Rroonga is fast!"} +] + +select Memos \ + --slices[groonga].match_columns '_key' \ + --slices[groonga].query 'Groonga' \ + --slices[groonga].output_columns ':' -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181127/15926cd5/attachment-0001.html>