Kouhei Sutou
null+****@clear*****
Mon Dec 4 23:05:11 JST 2017
Kouhei Sutou 2017-12-04 23:05:11 +0900 (Mon, 04 Dec 2017) New Revision: 30b93e9693734aa8f58db8351bb827a8e8f8ee6e https://github.com/groonga/groonga/commit/30b93e9693734aa8f58db8351bb827a8e8f8ee6e Message: logical_count: log count into query log Added files: test/command/suite/sharding/logical_count/query_log.expected test/command/suite/sharding/logical_count/query_log.test Modified files: plugins/sharding/logical_count.rb Modified: plugins/sharding/logical_count.rb (+1 -0) =================================================================== --- plugins/sharding/logical_count.rb 2017-12-04 23:00:20 +0900 (3dbc0d79a) +++ plugins/sharding/logical_count.rb 2017-12-04 23:05:11 +0900 (5dbb28e9b) @@ -29,6 +29,7 @@ module Groonga "shard_key: <#{enumerator.shard_key_name}>" raise InvalidArgument, message end + query_logger.log(:size, ":", "count(#{total})") writer.write(total) end Added: test/command/suite/sharding/logical_count/query_log.expected (+22 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/query_log.expected 2017-12-04 23:05:11 +0900 (2e5d8a2eb) @@ -0,0 +1,22 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170315 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170315 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] +[[0,0.0,0.0],3] +logical_count Logs --shard_key timestamp --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_with_tax > 550' +[[0,0.0,0.0],2] +#>logical_count --columns[price_with_tax].flags "COLUMN_SCALAR" --columns[price_with_tax].stage "initial" --columns[price_with_tax].type "UInt32" --columns[price_with_tax].value "price * 1.08" --filter "price_with_tax > 550" --logical_table "Logs" --shard_key "timestamp" +#:000000000000000 filter(3) +#:000000000000000 filter(2) +#:000000000000000 count(2) +#<000000000000000 rc=0 Added: test/command/suite/sharding/logical_count/query_log.test (+24 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/query_log.test 2017-12-04 23:05:11 +0900 (723c60476) @@ -0,0 +1,24 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 price COLUMN_SCALAR UInt32 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] + +#@collect-query-log true +logical_count Logs \ + --shard_key timestamp \ + --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_with_tax > 550' +#@collect-query-log false -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171204/6ca18054/attachment-0001.htm