Kouhei Sutou
null+****@clear*****
Mon Feb 22 18:17:51 JST 2016
Kouhei Sutou 2016-02-22 18:17:51 +0900 (Mon, 22 Feb 2016) New Revision: 41b6765fba37de7638e3bac93e4e8eb91b553661 https://github.com/groonga/groonga/commit/41b6765fba37de7638e3bac93e4e8eb91b553661 Message: test: add tests for logical_range_filter and vector's element range search Added files: test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.expected test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.test test/command/suite/sharding/logical_range_filter/filter/vector_element/select.expected test/command/suite/sharding/logical_range_filter/filter/vector_element/select.test Added: test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.expected (+80 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.expected 2016-02-22 18:17:51 +0900 (b5d8bc2) @@ -0,0 +1,80 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create UserIDs TABLE_PAT_KEY UInt32 +[[0,0.0,0.0],true] +table_create Logs_20150205 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150205 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150205 memo COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Logs_20150205 user_ids COLUMN_VECTOR UserIDs +[[0,0.0,0.0],true] +table_create Timestamp_20150205 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Timestamp_20150205 index COLUMN_INDEX Logs_20150205 timestamp +[[0,0.0,0.0],true] +column_create UserIDs index_20150205 COLUMN_INDEX|WITH_POSITION Logs_20150205 user_ids +[[0,0.0,0.0],true] +load --table Logs_20150205 +[ +{ + "timestamp": "2015-02-05 13:49:00", + "memo": "2015-02-05 13:49:00", + "user_ids": [1, 3, 5] +}, +{ + "timestamp": "2015-02-05 13:50:00", + "memo": "2015-02-05 13:50:00", + "user_ids": [2, 4, 6] +}, +{ + "timestamp": "2015-02-05 13:51:00", + "memo": "2015-02-05 13:51:00", + "user_ids": [2, 8, 14] +}, +{ + "timestamp": "2015-02-05 13:52:00", + "memo": "2015-02-05 13:52:00", + "user_ids": [3, 5, 7] +} +] +[[0,0.0,0.0],4] +log_level --level debug +[[0,0.0,0.0],true] +logical_range_filter Logs timestamp --limit 1 --filter 'user_ids[1] < 5' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "memo", + "ShortText" + ], + [ + "timestamp", + "Time" + ], + [ + "user_ids", + "UserIDs" + ] + ], + [ + "2015-02-05 13:49:00", + 1423111740.0, + [ + 1, + 3, + 5 + ] + ] + ] +] +#|d| [logical_range_filter][range-index] <Logs_20150205>: hit ratio (2.75=11/4) >= threshold (0.2) +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/filter/vector_element/range_index.test 2016-02-22 18:17:51 +0900 (c0d658e) @@ -0,0 +1,49 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create UserIDs TABLE_PAT_KEY UInt32 + +table_create Logs_20150205 TABLE_NO_KEY +column_create Logs_20150205 timestamp COLUMN_SCALAR Time +column_create Logs_20150205 memo COLUMN_SCALAR ShortText +column_create Logs_20150205 user_ids COLUMN_VECTOR UserIDs + +table_create Timestamp_20150205 TABLE_PAT_KEY Time +column_create Timestamp_20150205 index COLUMN_INDEX Logs_20150205 timestamp + +column_create UserIDs index_20150205 COLUMN_INDEX|WITH_POSITION \ + Logs_20150205 user_ids + + +load --table Logs_20150205 +[ +{ + "timestamp": "2015-02-05 13:49:00", + "memo": "2015-02-05 13:49:00", + "user_ids": [1, 3, 5] +}, +{ + "timestamp": "2015-02-05 13:50:00", + "memo": "2015-02-05 13:50:00", + "user_ids": [2, 4, 6] +}, +{ + "timestamp": "2015-02-05 13:51:00", + "memo": "2015-02-05 13:51:00", + "user_ids": [2, 8, 14] +}, +{ + "timestamp": "2015-02-05 13:52:00", + "memo": "2015-02-05 13:52:00", + "user_ids": [3, 5, 7] +} +] + +#@add-important-log-levels debug +log_level --level debug +logical_range_filter Logs timestamp \ + --limit 1 \ + --filter 'user_ids[1] < 5' +log_level --level notice +#@remove-important-log-levels debug Added: test/command/suite/sharding/logical_range_filter/filter/vector_element/select.expected (+89 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/filter/vector_element/select.expected 2016-02-22 18:17:51 +0900 (8b63b31) @@ -0,0 +1,89 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create UserIDs TABLE_PAT_KEY UInt32 +[[0,0.0,0.0],true] +table_create Logs_20150205 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20150205 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20150205 memo COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +column_create Logs_20150205 user_ids COLUMN_VECTOR UserIDs +[[0,0.0,0.0],true] +table_create Timestamp_20150205 TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Timestamp_20150205 index COLUMN_INDEX Logs_20150205 timestamp +[[0,0.0,0.0],true] +column_create UserIDs index_20150205 COLUMN_INDEX|WITH_POSITION Logs_20150205 user_ids +[[0,0.0,0.0],true] +load --table Logs_20150205 +[ +{ + "timestamp": "2015-02-05 13:49:00", + "memo": "2015-02-05 13:49:00", + "user_ids": [1, 3, 5] +}, +{ + "timestamp": "2015-02-05 13:50:00", + "memo": "2015-02-05 13:50:00", + "user_ids": [2, 4, 6] +}, +{ + "timestamp": "2015-02-05 13:51:00", + "memo": "2015-02-05 13:51:00", + "user_ids": [2, 8, 14] +}, +{ + "timestamp": "2015-02-05 13:52:00", + "memo": "2015-02-05 13:52:00", + "user_ids": [3, 5, 7] +} +] +[[0,0.0,0.0],4] +log_level --level debug +[[0,0.0,0.0],true] +logical_range_filter Logs timestamp --limit -1 --filter 'user_ids[1] < 5' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "memo", + "ShortText" + ], + [ + "timestamp", + "Time" + ], + [ + "user_ids", + "UserIDs" + ] + ], + [ + "2015-02-05 13:49:00", + 1423111740.0, + [ + 1, + 3, + 5 + ] + ], + [ + "2015-02-05 13:50:00", + 1423111800.0, + [ + 2, + 4, + 6 + ] + ] + ] +] +#|d| [logical_range_filter][select] <Logs_20150205>: limit is negative: <-1> +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/sharding/logical_range_filter/filter/vector_element/select.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/filter/vector_element/select.test 2016-02-22 18:17:51 +0900 (c43bee2) @@ -0,0 +1,49 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create UserIDs TABLE_PAT_KEY UInt32 + +table_create Logs_20150205 TABLE_NO_KEY +column_create Logs_20150205 timestamp COLUMN_SCALAR Time +column_create Logs_20150205 memo COLUMN_SCALAR ShortText +column_create Logs_20150205 user_ids COLUMN_VECTOR UserIDs + +table_create Timestamp_20150205 TABLE_PAT_KEY Time +column_create Timestamp_20150205 index COLUMN_INDEX Logs_20150205 timestamp + +column_create UserIDs index_20150205 COLUMN_INDEX|WITH_POSITION \ + Logs_20150205 user_ids + + +load --table Logs_20150205 +[ +{ + "timestamp": "2015-02-05 13:49:00", + "memo": "2015-02-05 13:49:00", + "user_ids": [1, 3, 5] +}, +{ + "timestamp": "2015-02-05 13:50:00", + "memo": "2015-02-05 13:50:00", + "user_ids": [2, 4, 6] +}, +{ + "timestamp": "2015-02-05 13:51:00", + "memo": "2015-02-05 13:51:00", + "user_ids": [2, 8, 14] +}, +{ + "timestamp": "2015-02-05 13:52:00", + "memo": "2015-02-05 13:52:00", + "user_ids": [3, 5, 7] +} +] + +#@add-important-log-levels debug +log_level --level debug +logical_range_filter Logs timestamp \ + --limit -1 \ + --filter 'user_ids[1] < 5' +log_level --level notice +#@remove-important-log-levels debug -------------- next part -------------- HTML����������������������������...Download