Kouhei Sutou
null+****@clear*****
Wed Jul 13 16:33:44 JST 2016
Kouhei Sutou 2016-07-13 16:33:44 +0900 (Wed, 13 Jul 2016) New Revision: 667d591d902e2ee99d5884d33959fbc9ae612a0a https://github.com/groonga/groonga/commit/667d591d902e2ee99d5884d33959fbc9ae612a0a Message: Support index range search for _key of PAT/DAT table GitHub: fix #583 Added files: test/command/suite/select/index/range/greater/_key.expected test/command/suite/select/index/range/greater/_key.test test/command/suite/select/index/range/greater/nested_key.expected test/command/suite/select/index/range/greater/nested_key.test test/command/suite/select/index/range/greater_equal/_key.expected test/command/suite/select/index/range/greater_equal/_key.test test/command/suite/select/index/range/greater_equal/nested_key.expected test/command/suite/select/index/range/greater_equal/nested_key.test test/command/suite/select/index/range/less/_key.expected test/command/suite/select/index/range/less/_key.test test/command/suite/select/index/range/less/nested_key.expected test/command/suite/select/index/range/less/nested_key.test test/command/suite/select/index/range/less_equal/_key.expected test/command/suite/select/index/range/less_equal/_key.test test/command/suite/select/index/range/less_equal/nested_key.expected test/command/suite/select/index/range/less_equal/nested_key.test Modified files: lib/db.c lib/expr.c test/command/suite/select/column/stage/initial/index.expected test/command/suite/select/column/stage/initial/index.test test/command/suite/select/columns/stage/initial/index.expected test/command/suite/select/columns/stage/initial/index.test Modified: lib/db.c (+68 -0) =================================================================== --- lib/db.c 2016-07-13 15:50:56 +0900 (554bbf6) +++ lib/db.c 2016-07-13 16:33:44 +0900 (87dfa18) @@ -12214,6 +12214,49 @@ grn_column_find_index_data_accessor_index_column(grn_ctx *ctx, grn_accessor *a, return 1; } +static grn_bool +grn_column_find_index_data_accessor_is_key_search(grn_ctx *ctx, + grn_accessor *accessor, + grn_operator op) +{ + if (accessor->next) { + return GRN_FALSE; + } + + if (accessor->action != GRN_ACCESSOR_GET_KEY) { + return GRN_FALSE; + } + + if (!grn_obj_is_table(ctx, accessor->obj)) { + return GRN_FALSE; + } + + switch (op) { + case GRN_OP_LESS : + case GRN_OP_GREATER : + case GRN_OP_LESS_EQUAL : + case GRN_OP_GREATER_EQUAL : + switch (accessor->obj->header.type) { + case GRN_TABLE_PAT_KEY : + case GRN_TABLE_DAT_KEY : + return GRN_TRUE; + default : + return GRN_FALSE; + } + case GRN_OP_EQUAL : + switch (accessor->obj->header.type) { + case GRN_TABLE_HASH_KEY : + case GRN_TABLE_PAT_KEY : + case GRN_TABLE_DAT_KEY : + return GRN_TRUE; + default : + return GRN_FALSE; + } + default : + return GRN_FALSE; + } +} + static int grn_column_find_index_data_accessor_match(grn_ctx *ctx, grn_obj *obj, grn_operator op, @@ -12286,6 +12329,31 @@ grn_column_find_index_data_accessor_match(grn_ctx *ctx, grn_obj *obj, } if (!found && + grn_column_find_index_data_accessor_is_key_search(ctx, a, op)) { + grn_obj *index; + int section = 0; + + if ((grn_obj *)a == obj) { + index = a->obj; + } else { + index = (grn_obj *)a; + } + + found = GRN_TRUE; + if (section_buf) { + *section_buf = section; + } + if (n < buf_size) { + *ip++ = index; + } + if (n < n_index_data) { + index_data[n].index = index; + index_data[n].section = section; + } + n++; + } + + if (!found && a->next && grn_obj_is_table(ctx, a->obj) && a->obj->header.domain == a->next->obj->header.domain) { Modified: lib/expr.c (+128 -21) =================================================================== --- lib/expr.c 2016-07-13 15:50:56 +0900 (01c2ce2) +++ lib/expr.c 2016-07-13 16:33:44 +0900 (66da510) @@ -6115,6 +6115,90 @@ grn_table_select_index_not_equal(grn_ctx *ctx, } static inline grn_bool +grn_table_select_index_range_key(grn_ctx *ctx, + grn_obj *table, + scan_info *si, + grn_operator logical_op, + grn_obj *res) +{ + const char *tag = "[range][key]"; + grn_bool processed = GRN_FALSE; + grn_obj key; + + if (grn_table_select_index_use_sequential_search(ctx, + table, + res, + logical_op, + tag, + table)) { + return GRN_FALSE; + } + + GRN_OBJ_INIT(&key, GRN_BULK, 0, table->header.domain); + if (grn_obj_cast(ctx, si->query, &key, GRN_FALSE) == GRN_SUCCESS) { + grn_table_cursor *cursor; + const void *min = NULL, *max = NULL; + unsigned int min_size = 0, max_size = 0; + int offset = 0; + int limit = -1; + int flags = GRN_CURSOR_ASCENDING; + + grn_table_select_index_report(ctx, tag, table); + + switch (si->op) { + case GRN_OP_LESS : + flags |= GRN_CURSOR_LT; + max = GRN_BULK_HEAD(&key); + max_size = GRN_BULK_VSIZE(&key); + break; + case GRN_OP_GREATER : + flags |= GRN_CURSOR_GT; + min = GRN_BULK_HEAD(&key); + min_size = GRN_BULK_VSIZE(&key); + break; + case GRN_OP_LESS_EQUAL : + flags |= GRN_CURSOR_LE; + max = GRN_BULK_HEAD(&key); + max_size = GRN_BULK_VSIZE(&key); + break; + case GRN_OP_GREATER_EQUAL : + flags |= GRN_CURSOR_GE; + min = GRN_BULK_HEAD(&key); + min_size = GRN_BULK_VSIZE(&key); + break; + default : + break; + } + cursor = grn_table_cursor_open(ctx, table, + min, min_size, max, max_size, + offset, limit, flags); + if (cursor) { + uint32_t sid; + int32_t weight; + + sid = GRN_UINT32_VALUE_AT(&(si->wv), 0); + weight = GRN_INT32_VALUE_AT(&(si->wv), 1); + + if (sid == 0) { + grn_posting posting = {0}; + + posting.weight = weight - 1; + while ((posting.rid = grn_table_cursor_next(ctx, cursor))) { + grn_ii_posting_add(ctx, &posting, (grn_hash *)res, logical_op); + } + } + processed = GRN_TRUE; + grn_table_cursor_close(ctx, cursor); + } + + grn_ii_resolve_sel_and(ctx, (grn_hash *)res, logical_op); + } + GRN_OBJ_FIN(ctx, &key); + + return processed; +} + +static inline grn_bool grn_table_select_index_range_column(grn_ctx *ctx, grn_obj *table, grn_obj *index, scan_info *si, grn_operator logical_op, @@ -6254,7 +6338,8 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, n_accessors = 0; for (a = (grn_accessor *)accessor; a; a = a->next) { n_accessors++; - if (GRN_OBJ_INDEX_COLUMNP(a->obj)) { + if (GRN_OBJ_INDEX_COLUMNP(a->obj) || + grn_obj_is_table(ctx, a->obj)) { break; } } @@ -6263,24 +6348,40 @@ grn_table_select_index_range_accessor(grn_ctx *ctx, grn_obj *index; grn_obj *range; - if (grn_column_index(ctx, last_obj, si->op, &index, 1, NULL) == 0) { - return GRN_FALSE; - } + if (grn_obj_is_table(ctx, last_obj)) { + index = last_obj; + range = last_obj; + base_res = grn_table_create(ctx, NULL, 0, NULL, + GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, + range, + NULL); + if (!base_res) { + return GRN_FALSE; + } + if (!grn_table_select_index_range_key(ctx, last_obj, si, GRN_OP_OR, + base_res)) { + grn_obj_unlink(ctx, base_res); + return GRN_FALSE; + } + } else { + if (grn_column_index(ctx, last_obj, si->op, &index, 1, NULL) == 0) { + return GRN_FALSE; + } - range = grn_ctx_at(ctx, DB_OBJ(index)->range); - base_res = grn_table_create(ctx, NULL, 0, NULL, - GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, - range, - NULL); - if (!base_res) { - return GRN_FALSE; - } - if (!grn_table_select_index_range_column(ctx, table, index, si, GRN_OP_OR, - base_res)) { - grn_obj_unlink(ctx, base_res); - return GRN_FALSE; + range = grn_ctx_at(ctx, DB_OBJ(index)->range); + base_res = grn_table_create(ctx, NULL, 0, NULL, + GRN_TABLE_HASH_KEY|GRN_OBJ_WITH_SUBREC, + range, + NULL); + if (!base_res) { + return GRN_FALSE; + } + if (!grn_table_select_index_range_column(ctx, table, index, si, GRN_OP_OR, + base_res)) { + grn_obj_unlink(ctx, base_res); + return GRN_FALSE; + } } - grn_table_select_index_report(ctx, "[range][accessor]", index); } @@ -6295,12 +6396,18 @@ grn_table_select_index_range(grn_ctx *ctx, grn_obj *table, grn_obj *index, scan_info *si, grn_obj *res) { if (si->flags & SCAN_ACCESSOR) { - if (index->header.type != GRN_ACCESSOR) { + switch (index->header.type) { + case GRN_TABLE_PAT_KEY : + case GRN_TABLE_DAT_KEY : + /* table == index */ + return grn_table_select_index_range_key(ctx, table, si, + si->logical_op, res); + case GRN_ACCESSOR : + return grn_table_select_index_range_accessor(ctx, table, index, si, + si->logical_op, res); + default : return GRN_FALSE; } - - return grn_table_select_index_range_accessor(ctx, table, index, si, - si->logical_op, res); } else { return grn_table_select_index_range_column(ctx, table, index, si, si->logical_op, res); Modified: test/command/suite/select/column/stage/initial/index.expected (+13 -13) =================================================================== --- test/command/suite/select/column/stage/initial/index.expected 2016-07-13 15:50:56 +0900 (3f65f92) +++ test/command/suite/select/column/stage/initial/index.expected 2016-07-13 16:33:44 +0900 (a4dd7a5) @@ -18,7 +18,7 @@ load --table Items [[0,0.0,0.0],6] log_level --level info [[0,0.0,0.0],true] -select Items --column[price_with_tax].stage initial --column[price_with_tax].type UInt32 --column[price_with_tax].flags COLUMN_SCALAR --column[price_with_tax].value 'price * 1.08' --filter 'price >= 510' +select Items --column[price_with_tax].stage initial --column[price_with_tax].type UInt32 --column[price_with_tax].flags COLUMN_SCALAR --column[price_with_tax].value 'price * 1.08' --filter 'price >= 510' --sort_keys _id [ [ 0, @@ -49,18 +49,6 @@ select Items --column[price_with_tax].stage initial --column[price_with_tax] ] ], [ - 4, - "Pen", - 550, - 510 - ], - [ - 3, - "Box", - 561, - 520 - ], - [ 1, "Book", 1080, @@ -71,6 +59,18 @@ select Items --column[price_with_tax].stage initial --column[price_with_tax] "Note", 1080, 1000 + ], + [ + 3, + "Box", + 561, + 520 + ], + [ + 4, + "Pen", + 550, + 510 ] ] ] Modified: test/command/suite/select/column/stage/initial/index.test (+2 -1) =================================================================== --- test/command/suite/select/column/stage/initial/index.test 2016-07-13 15:50:56 +0900 (1f3257e) +++ test/command/suite/select/column/stage/initial/index.test 2016-07-13 16:33:44 +0900 (5aef9fc) @@ -21,6 +21,7 @@ select Items \ --column[price_with_tax].type UInt32 \ --column[price_with_tax].flags COLUMN_SCALAR \ --column[price_with_tax].value 'price * 1.08' \ - --filter 'price >= 510' + --filter 'price >= 510' \ + --sort_keys _id log_level --level notice #@remove-important-log-levels info Modified: test/command/suite/select/columns/stage/initial/index.expected (+13 -13) =================================================================== --- test/command/suite/select/columns/stage/initial/index.expected 2016-07-13 15:50:56 +0900 (d521eb3) +++ test/command/suite/select/columns/stage/initial/index.expected 2016-07-13 16:33:44 +0900 (41503d1) @@ -18,7 +18,7 @@ load --table Items [[0,0.0,0.0],6] log_level --level info [[0,0.0,0.0],true] -select Items --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --filter 'price >= 510' +select Items --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --filter 'price >= 510' --sort_keys _id [ [ 0, @@ -49,18 +49,6 @@ select Items --columns[price_with_tax].stage initial --columns[price_with_ta ] ], [ - 4, - "Pen", - 550, - 510 - ], - [ - 3, - "Box", - 561, - 520 - ], - [ 1, "Book", 1080, @@ -71,6 +59,18 @@ select Items --columns[price_with_tax].stage initial --columns[price_with_ta "Note", 1080, 1000 + ], + [ + 3, + "Box", + 561, + 520 + ], + [ + 4, + "Pen", + 550, + 510 ] ] ] Modified: test/command/suite/select/columns/stage/initial/index.test (+2 -1) =================================================================== --- test/command/suite/select/columns/stage/initial/index.test 2016-07-13 15:50:56 +0900 (848a745) +++ test/command/suite/select/columns/stage/initial/index.test 2016-07-13 16:33:44 +0900 (c71d23e) @@ -21,6 +21,7 @@ select Items \ --columns[price_with_tax].type UInt32 \ --columns[price_with_tax].flags COLUMN_SCALAR \ --columns[price_with_tax].value 'price * 1.08' \ - --filter 'price >= 510' + --filter 'price >= 510' \ + --sort_keys _id log_level --level notice #@remove-important-log-levels info Added: test/command/suite/select/index/range/greater/_key.expected (+16 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater/_key.expected 2016-07-13 16:33:44 +0900 (3f4f689) @@ -0,0 +1,16 @@ +table_create Ages TABLE_PAT_KEY Int32 +[[0,0.0,0.0],true] +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] +[[0,0.0,0.0],5] +log_level --level info +[[0,0.0,0.0],true] +select Ages --filter '_key > 29' --output_columns '_key, _score' +[[0,0.0,0.0],[[[2],[["_key","Int32"],["_score","Int32"]],[30,1],[39,1]]]] +#|i| [table][select][index][range][key] <Ages> Added: test/command/suite/select/index/range/greater/_key.test (+14 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater/_key.test 2016-07-13 16:33:44 +0900 (18c9d14) @@ -0,0 +1,14 @@ +table_create Ages TABLE_PAT_KEY Int32 + +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] + +log_level --level info +#@add-important-log-levels info +select Ages --filter '_key > 29' --output_columns '_key, _score' Added: test/command/suite/select/index/range/greater/nested_key.expected (+53 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater/nested_key.expected 2016-07-13 16:33:44 +0900 (8b5e975) @@ -0,0 +1,53 @@ +table_create Ages TABLE_PAT_KEY Int8 +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users age COLUMN_SCALAR Ages +[[0,0.0,0.0],true] +column_create Ages users_age COLUMN_INDEX Users age +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] +[[0,0.0,0.0],3] +log_level --level info +[[0,0.0,0.0],true] +select Users --filter 'age._key > 29' --output_columns '_key, age, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "age", + "Ages" + ], + [ + "_score", + "Int32" + ] + ], + [ + "Bob", + 30, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> +#|i| [table][select][index][range][accessor] <Ages> Added: test/command/suite/select/index/range/greater/nested_key.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater/nested_key.test 2016-07-13 16:33:44 +0900 (092584b) @@ -0,0 +1,17 @@ +table_create Ages TABLE_PAT_KEY Int8 + +table_create Users TABLE_HASH_KEY ShortText +column_create Users age COLUMN_SCALAR Ages + +column_create Ages users_age COLUMN_INDEX Users age + +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] + +log_level --level info +#@add-important-log-levels info +select Users --filter 'age._key > 29' --output_columns '_key, age, _score' Added: test/command/suite/select/index/range/greater_equal/_key.expected (+51 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater_equal/_key.expected 2016-07-13 16:33:44 +0900 (93106e6) @@ -0,0 +1,51 @@ +table_create Ages TABLE_PAT_KEY Int32 +[[0,0.0,0.0],true] +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] +[[0,0.0,0.0],5] +log_level --level info +[[0,0.0,0.0],true] +select Ages --filter '_key >= 29' --output_columns '_key, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_key", + "Int32" + ], + [ + "_score", + "Int32" + ] + ], + [ + 29, + 1 + ], + [ + 30, + 1 + ], + [ + 39, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> Added: test/command/suite/select/index/range/greater_equal/_key.test (+14 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater_equal/_key.test 2016-07-13 16:33:44 +0900 (5c4ca1e) @@ -0,0 +1,14 @@ +table_create Ages TABLE_PAT_KEY Int32 + +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] + +log_level --level info +#@add-important-log-levels info +select Ages --filter '_key >= 29' --output_columns '_key, _score' Added: test/command/suite/select/index/range/greater_equal/nested_key.expected (+58 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater_equal/nested_key.expected 2016-07-13 16:33:44 +0900 (7010868) @@ -0,0 +1,58 @@ +table_create Ages TABLE_PAT_KEY Int8 +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users age COLUMN_SCALAR Ages +[[0,0.0,0.0],true] +column_create Ages users_age COLUMN_INDEX Users age +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] +[[0,0.0,0.0],3] +log_level --level info +[[0,0.0,0.0],true] +select Users --filter 'age._key >= 29' --output_columns '_key, age, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 2 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "age", + "Ages" + ], + [ + "_score", + "Int32" + ] + ], + [ + "Alice", + 29, + 1 + ], + [ + "Bob", + 30, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> +#|i| [table][select][index][range][accessor] <Ages> Added: test/command/suite/select/index/range/greater_equal/nested_key.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/greater_equal/nested_key.test 2016-07-13 16:33:44 +0900 (9dbb4e0) @@ -0,0 +1,17 @@ +table_create Ages TABLE_PAT_KEY Int8 + +table_create Users TABLE_HASH_KEY ShortText +column_create Users age COLUMN_SCALAR Ages + +column_create Ages users_age COLUMN_INDEX Users age + +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] + +log_level --level info +#@add-important-log-levels info +select Users --filter 'age._key >= 29' --output_columns '_key, age, _score' Added: test/command/suite/select/index/range/less/_key.expected (+16 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less/_key.expected 2016-07-13 16:33:44 +0900 (5909f29) @@ -0,0 +1,16 @@ +table_create Ages TABLE_PAT_KEY Int32 +[[0,0.0,0.0],true] +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] +[[0,0.0,0.0],5] +log_level --level info +[[0,0.0,0.0],true] +select Ages --filter '_key < 29' --output_columns '_key, _score' +[[0,0.0,0.0],[[[2],[["_key","Int32"],["_score","Int32"]],[19,1],[28,1]]]] +#|i| [table][select][index][range][key] <Ages> Added: test/command/suite/select/index/range/less/_key.test (+14 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less/_key.test 2016-07-13 16:33:44 +0900 (6ea6fc1) @@ -0,0 +1,14 @@ +table_create Ages TABLE_PAT_KEY Int32 + +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] + +log_level --level info +#@add-important-log-levels info +select Ages --filter '_key < 29' --output_columns '_key, _score' Added: test/command/suite/select/index/range/less/nested_key.expected (+53 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less/nested_key.expected 2016-07-13 16:33:44 +0900 (67804e8) @@ -0,0 +1,53 @@ +table_create Ages TABLE_PAT_KEY Int8 +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users age COLUMN_SCALAR Ages +[[0,0.0,0.0],true] +column_create Ages users_age COLUMN_INDEX Users age +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] +[[0,0.0,0.0],3] +log_level --level info +[[0,0.0,0.0],true] +select Users --filter 'age._key < 29' --output_columns '_key, age, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 1 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "age", + "Ages" + ], + [ + "_score", + "Int32" + ] + ], + [ + "Carlos", + 28, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> +#|i| [table][select][index][range][accessor] <Ages> Added: test/command/suite/select/index/range/less/nested_key.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less/nested_key.test 2016-07-13 16:33:44 +0900 (dce913d) @@ -0,0 +1,17 @@ +table_create Ages TABLE_PAT_KEY Int8 + +table_create Users TABLE_HASH_KEY ShortText +column_create Users age COLUMN_SCALAR Ages + +column_create Ages users_age COLUMN_INDEX Users age + +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] + +log_level --level info +#@add-important-log-levels info +select Users --filter 'age._key < 29' --output_columns '_key, age, _score' Added: test/command/suite/select/index/range/less_equal/_key.expected (+51 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less_equal/_key.expected 2016-07-13 16:33:44 +0900 (5aec8dd) @@ -0,0 +1,51 @@ +table_create Ages TABLE_PAT_KEY Int32 +[[0,0.0,0.0],true] +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] +[[0,0.0,0.0],5] +log_level --level info +[[0,0.0,0.0],true] +select Ages --filter '_key <= 29' --output_columns '_key, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_key", + "Int32" + ], + [ + "_score", + "Int32" + ] + ], + [ + 19, + 1 + ], + [ + 28, + 1 + ], + [ + 29, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> Added: test/command/suite/select/index/range/less_equal/_key.test (+14 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less_equal/_key.test 2016-07-13 16:33:44 +0900 (8ad28ab) @@ -0,0 +1,14 @@ +table_create Ages TABLE_PAT_KEY Int32 + +load --table Ages +[ +{"_key": 19}, +{"_key": 28}, +{"_key": 29}, +{"_key": 30}, +{"_key": 39} +] + +log_level --level info +#@add-important-log-levels info +select Ages --filter '_key <= 29' --output_columns '_key, _score' Added: test/command/suite/select/index/range/less_equal/nested_key.expected (+58 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less_equal/nested_key.expected 2016-07-13 16:33:44 +0900 (d5aefbe) @@ -0,0 +1,58 @@ +table_create Ages TABLE_PAT_KEY Int8 +[[0,0.0,0.0],true] +table_create Users TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Users age COLUMN_SCALAR Ages +[[0,0.0,0.0],true] +column_create Ages users_age COLUMN_INDEX Users age +[[0,0.0,0.0],true] +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] +[[0,0.0,0.0],3] +log_level --level info +[[0,0.0,0.0],true] +select Users --filter 'age._key <= 29' --output_columns '_key, age, _score' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 2 + ], + [ + [ + "_key", + "ShortText" + ], + [ + "age", + "Ages" + ], + [ + "_score", + "Int32" + ] + ], + [ + "Carlos", + 28, + 1 + ], + [ + "Alice", + 29, + 1 + ] + ] + ] +] +#|i| [table][select][index][range][key] <Ages> +#|i| [table][select][index][range][accessor] <Ages> Added: test/command/suite/select/index/range/less_equal/nested_key.test (+17 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/select/index/range/less_equal/nested_key.test 2016-07-13 16:33:44 +0900 (4f662b3) @@ -0,0 +1,17 @@ +table_create Ages TABLE_PAT_KEY Int8 + +table_create Users TABLE_HASH_KEY ShortText +column_create Users age COLUMN_SCALAR Ages + +column_create Ages users_age COLUMN_INDEX Users age + +load --table Users +[ +{"_key": "Alice", "age": 29}, +{"_key": "Bob", "age": 30}, +{"_key": "Carlos", "age": 28} +] + +log_level --level info +#@add-important-log-levels info +select Users --filter 'age._key <= 29' --output_columns '_key, age, _score' -------------- next part -------------- HTML����������������������������... 下載