Yasuhiro Horimoto 2019-04-22 09:29:56 +0900 (Mon, 22 Apr 2019) Revision: 5b53e0c00e89fd7b68362287ae3fdab46a38cd61 https://github.com/groonga/groonga/commit/5b53e0c00e89fd7b68362287ae3fdab46a38cd61 Message: test logical_count: add test for window function over shards (#943) Added files: test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.expected test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.test test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.expected test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.test Added: test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.expected (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.expected 2019-04-22 09:29:56 +0900 (fa5c35867) @@ -0,0 +1,45 @@ +plugin_register sharding +[[0,0.0,0.0],true] +plugin_register functions/time +[[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] +table_create Logs_20170316 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170316 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170427 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170427 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170427 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] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 00:00:00", "price": 530}, +{"timestamp": "2017/03/16 01:00:00", "price": 520}, +{"timestamp": "2017/03/16 02:00:00", "price": 110} +] +[[0,0.0,0.0],3] +load --table Logs_20170427 +[ +{"timestamp": "2017/04/27 00:00:00", "price": 800}, +{"timestamp": "2017/04/27 01:00:00", "price": 400}, +{"timestamp": "2017/04/27 02:00:00", "price": 300} +] +[[0,0.0,0.0],3] +logical_count Logs --shard_key timestamp --columns[month].stage initial --columns[month].type Time --columns[month].flags COLUMN_SCALAR --columns[month].value 'time_classify_month(timestamp)' --filter 'price > 300' --columns[price_per_month].stage filtered --columns[price_per_month].type UInt32 --columns[price_per_month].flags COLUMN_SCALAR --columns[price_per_month].value 'window_sum(price)' --columns[price_per_month].window.group_keys 'month' --post_filter 'price_per_month > 1500' +[[0,0.0,0.0],4] Added: test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.test (+49 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/columns/stage/filtered/window_function_over_shard.test 2019-04-22 09:29:56 +0900 (ec5bf3a73) @@ -0,0 +1,49 @@ +plugin_register sharding +plugin_register functions/time + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 price COLUMN_SCALAR UInt32 + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 price COLUMN_SCALAR UInt32 + +table_create Logs_20170427 TABLE_NO_KEY +column_create Logs_20170427 timestamp COLUMN_SCALAR Time +column_create Logs_20170427 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} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 00:00:00", "price": 530}, +{"timestamp": "2017/03/16 01:00:00", "price": 520}, +{"timestamp": "2017/03/16 02:00:00", "price": 110} +] + +load --table Logs_20170427 +[ +{"timestamp": "2017/04/27 00:00:00", "price": 800}, +{"timestamp": "2017/04/27 01:00:00", "price": 400}, +{"timestamp": "2017/04/27 02:00:00", "price": 300} +] + +logical_count Logs \ + --shard_key timestamp \ + --columns[month].stage initial \ + --columns[month].type Time \ + --columns[month].flags COLUMN_SCALAR \ + --columns[month].value 'time_classify_month(timestamp)' \ + --filter 'price > 300' \ + --columns[price_per_month].stage filtered \ + --columns[price_per_month].type UInt32 \ + --columns[price_per_month].flags COLUMN_SCALAR \ + --columns[price_per_month].value 'window_sum(price)' \ + --columns[price_per_month].window.group_keys 'month' \ + --post_filter 'price_per_month > 1500' Added: test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.expected (+45 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.expected 2019-04-22 09:29:56 +0900 (fc825b9d7) @@ -0,0 +1,45 @@ +plugin_register sharding +[[0,0.0,0.0],true] +plugin_register functions/time +[[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] +table_create Logs_20170316 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170316 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170427 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170427 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170427 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] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 00:00:00", "price": 530}, +{"timestamp": "2017/03/16 01:00:00", "price": 520}, +{"timestamp": "2017/03/16 02:00:00", "price": 110} +] +[[0,0.0,0.0],3] +load --table Logs_20170427 +[ +{"timestamp": "2017/04/27 00:00:00", "price": 800}, +{"timestamp": "2017/04/27 01:00:00", "price": 400}, +{"timestamp": "2017/04/27 02:00:00", "price": 300} +] +[[0,0.0,0.0],3] +logical_count Logs --shard_key timestamp --columns[month].stage initial --columns[month].type Time --columns[month].flags COLUMN_SCALAR --columns[month].value 'time_classify_month(timestamp)' --columns[price_per_month].stage initial --columns[price_per_month].type UInt32 --columns[price_per_month].flags COLUMN_SCALAR --columns[price_per_month].value 'window_sum(price)' --columns[price_per_month].window.group_keys 'month' --post_filter 'price_per_month > 2000' +[[0,0.0,0.0],6] Added: test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.test (+48 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_count/columns/stage/initial/window_function_over_shard.test 2019-04-22 09:29:56 +0900 (90b6dcfa2) @@ -0,0 +1,48 @@ +plugin_register sharding +plugin_register functions/time + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 price COLUMN_SCALAR UInt32 + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 price COLUMN_SCALAR UInt32 + +table_create Logs_20170427 TABLE_NO_KEY +column_create Logs_20170427 timestamp COLUMN_SCALAR Time +column_create Logs_20170427 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} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 00:00:00", "price": 530}, +{"timestamp": "2017/03/16 01:00:00", "price": 520}, +{"timestamp": "2017/03/16 02:00:00", "price": 110} +] + +load --table Logs_20170427 +[ +{"timestamp": "2017/04/27 00:00:00", "price": 800}, +{"timestamp": "2017/04/27 01:00:00", "price": 400}, +{"timestamp": "2017/04/27 02:00:00", "price": 300} +] + +logical_count Logs \ + --shard_key timestamp \ + --columns[month].stage initial \ + --columns[month].type Time \ + --columns[month].flags COLUMN_SCALAR \ + --columns[month].value 'time_classify_month(timestamp)' \ + --columns[price_per_month].stage initial \ + --columns[price_per_month].type UInt32 \ + --columns[price_per_month].flags COLUMN_SCALAR \ + --columns[price_per_month].value 'window_sum(price)' \ + --columns[price_per_month].window.group_keys 'month' \ + --post_filter 'price_per_month > 2000' -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190422/41841353/attachment-0001.html>