Kouhei Sutou
null+****@clear*****
Thu Apr 6 16:21:28 JST 2017
Kouhei Sutou 2017-04-06 16:21:28 +0900 (Thu, 06 Apr 2017) New Revision: 4442358cf467daed2524bf55d213ba27996f0371 https://github.com/groonga/groonga/commit/4442358cf467daed2524bf55d213ba27996f0371 Message: object_inspect: show column compress type Modified files: lib/proc/proc_object_inspect.c test/command/suite/object_inspect/column/index.expected test/command/suite/object_inspect/column/scalar_fix.expected test/command/suite/object_inspect/column/scalar_var.expected test/command/suite/object_inspect/column/scalar_var.test test/command/suite/object_inspect/column/vector.expected Modified: lib/proc/proc_object_inspect.c (+33 -1) =================================================================== --- lib/proc/proc_object_inspect.c 2017-04-06 16:18:23 +0900 (5590b0c) +++ lib/proc/proc_object_inspect.c 2017-04-06 16:21:28 +0900 (f3a6a77) @@ -229,13 +229,45 @@ command_object_inspect_column_type(grn_ctx *ctx, grn_obj *column) } static void +command_object_inspect_column_compress(grn_ctx *ctx, grn_obj *column) +{ + const char *compress = NULL; + + if (column->header.type != GRN_COLUMN_INDEX) { + grn_column_flags column_flags; + column_flags = grn_column_get_flags(ctx, column); + switch (column_flags & GRN_OBJ_COMPRESS_MASK) { + case GRN_OBJ_COMPRESS_ZLIB : + compress = "zlib"; + break; + case GRN_OBJ_COMPRESS_LZ4 : + compress = "lz4"; + break; + case GRN_OBJ_COMPRESS_ZSTD : + compress = "zstd"; + break; + default : + break; + } + } + + if (compress) { + grn_ctx_output_cstr(ctx, compress); + } else { + grn_ctx_output_null(ctx); + } +} + +static void command_object_inspect_column_value(grn_ctx *ctx, grn_obj *column) { - grn_ctx_output_map_open(ctx, "value", 1); + grn_ctx_output_map_open(ctx, "value", 2); { grn_id range_id = grn_obj_get_range(ctx, column); grn_ctx_output_cstr(ctx, "type"); command_object_inspect_type(ctx, grn_ctx_at(ctx, range_id)); + grn_ctx_output_cstr(ctx, "compress"); + command_object_inspect_column_compress(ctx, column); } grn_ctx_output_map_close(ctx); } Modified: test/command/suite/object_inspect/column/index.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/column/index.expected 2017-04-06 16:18:23 +0900 (70a51f5) +++ test/command/suite/object_inspect/column/index.expected 2017-04-06 16:21:28 +0900 (6cc7cd2) @@ -60,7 +60,8 @@ object_inspect Terms.memos_title_content "name": "table:no_key" }, "size": 4 - } + }, + "compress": null }, "section": true, "weight": false, Modified: test/command/suite/object_inspect/column/scalar_fix.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/column/scalar_fix.expected 2017-04-06 16:18:23 +0900 (0fc00e2) +++ test/command/suite/object_inspect/column/scalar_fix.expected 2017-04-06 16:21:28 +0900 (6548a07) @@ -54,7 +54,8 @@ object_inspect Users.age "name": "type" }, "size": 1 - } + }, + "compress": null }, "section": false, "weight": false, Modified: test/command/suite/object_inspect/column/scalar_var.expected (+3 -2) =================================================================== --- test/command/suite/object_inspect/column/scalar_var.expected 2017-04-06 16:18:23 +0900 (3bcdb3c) +++ test/command/suite/object_inspect/column/scalar_var.expected 2017-04-06 16:21:28 +0900 (8549c3d) @@ -1,6 +1,6 @@ table_create Memos TABLE_NO_KEY [[0,0.0,0.0],true] -column_create Memos title COLUMN_SCALAR ShortText +column_create Memos title COLUMN_SCALAR|COMPRESS_ZSTD ShortText [[0,0.0,0.0],true] object_inspect Memos.title [ @@ -42,7 +42,8 @@ object_inspect Memos.title "name": "type" }, "size": 4096 - } + }, + "compress": "zstd" }, "section": false, "weight": false, Modified: test/command/suite/object_inspect/column/scalar_var.test (+1 -1) =================================================================== --- test/command/suite/object_inspect/column/scalar_var.test 2017-04-06 16:18:23 +0900 (6503595) +++ test/command/suite/object_inspect/column/scalar_var.test 2017-04-06 16:21:28 +0900 (348745d) @@ -1,4 +1,4 @@ table_create Memos TABLE_NO_KEY -column_create Memos title COLUMN_SCALAR ShortText +column_create Memos title COLUMN_SCALAR|COMPRESS_ZSTD ShortText object_inspect Memos.title Modified: test/command/suite/object_inspect/column/vector.expected (+2 -1) =================================================================== --- test/command/suite/object_inspect/column/vector.expected 2017-04-06 16:18:23 +0900 (965eaa3) +++ test/command/suite/object_inspect/column/vector.expected 2017-04-06 16:21:28 +0900 (0768c76) @@ -42,7 +42,8 @@ object_inspect Memos.tags "name": "type" }, "size": 4096 - } + }, + "compress": null }, "section": false, "weight": false, -------------- next part -------------- HTML����������������������������... Download