Yasuhiro Horimoto 2019-04-22 17:10:48 +0900 (Mon, 22 Apr 2019) Revision: 23650bb5b8a888f0ae2374f80ccb0997315cbcef https://github.com/groonga/groonga/commit/23650bb5b8a888f0ae2374f80ccb0997315cbcef Message: test logical_select: add test for window function over shards (#940) * test logical_select: add test for window function over shards * test logical_select: add test for different order case * test logical_select: remove needless tests * test logical_select: fix wrong test cases * test logical_select: fix a wrong output column * test logical_select: fix wrong test cases Because these tests are unsupported cases. Added files: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.test test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.test test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.test test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.test test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.test test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.expected test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.test test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.test test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.test test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.test test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.test test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.test test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.test test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.expected test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.test test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.expected test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.test test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.expected test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.test test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.expected test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.test test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.expected test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.test Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.expected (+81 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.expected 2019-04-22 17:10:48 +0900 (23c7d9a73) @@ -0,0 +1,81 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 500} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.sort_keys price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 3, + 200, + 1 + ], + [ + 1, + 300, + 2 + ], + [ + 2, + 400, + 3 + ], + [ + 3, + 500, + 4 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.test (+35 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/ascending.test 2019-04-22 17:10:48 +0900 (84e6fb192) @@ -0,0 +1,35 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 500} +] + +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.expected (+81 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.expected 2019-04-22 17:10:48 +0900 (5231b6df2) @@ -0,0 +1,81 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 02:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 400}, +{"timestamp": "2017/04/16 12:00:00", "n_likes": 1, "price": 500} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.sort_keys -price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 3, + 200, + 4 + ], + [ + 1, + 300, + 3 + ], + [ + 2, + 400, + 2 + ], + [ + 3, + 500, + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.test (+35 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/descending.test 2019-04-22 17:10:48 +0900 (5f8eb90c2) @@ -0,0 +1,35 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 02:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 400}, +{"timestamp": "2017/04/16 12:00:00", "n_likes": 1, "price": 500} +] + +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.sort_keys -price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.expected (+85 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.expected 2019-04-22 17:10:48 +0900 (b05eead72) @@ -0,0 +1,85 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price,name --output_columns price,name,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "price", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "count", + "UInt32" + ] + ], + [ + 200, + "item2", + 2 + ], + [ + 200, + "item2", + 2 + ], + [ + 300, + "item3", + 1 + ], + [ + 300, + "item5", + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.test (+36 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_no_sort.test 2019-04-22 17:10:48 +0900 (807201f09) @@ -0,0 +1,36 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170415 name COLUMN_SCALAR ShortText + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170416 name COLUMN_SCALAR ShortText + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price,name \ + --output_columns price,name,count Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.expected (+93 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.expected 2019-04-22 17:10:48 +0900 (56ab23edd) @@ -0,0 +1,93 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price,name --columns[count].window.sort_keys price --output_columns _id,price,name,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "count", + "UInt32" + ] + ], + [ + 3, + 200, + "item2", + 1 + ], + [ + 1, + 200, + "item2", + 2 + ], + [ + 2, + 300, + "item3", + 1 + ], + [ + 3, + 300, + "item5", + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.test (+38 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_multiple_keys_sort.test 2019-04-22 17:10:48 +0900 (9cca9ee22) @@ -0,0 +1,38 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170415 name COLUMN_SCALAR ShortText + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170416 name COLUMN_SCALAR ShortText + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] + +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price,name \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,name,count Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.expected (+73 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.expected 2019-04-22 17:10:48 +0900 (4b32e1427) @@ -0,0 +1,73 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price --output_columns price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 200, + 2 + ], + [ + 200, + 2 + ], + [ + 300, + 2 + ], + [ + 300, + 2 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.test (+34 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_no_sort.test 2019-04-22 17:10:48 +0900 (9f3af49ba) @@ -0,0 +1,34 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price \ + --output_columns price,count Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.expected (+81 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.expected 2019-04-22 17:10:48 +0900 (35f4c169c) @@ -0,0 +1,81 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --filter 'price > 100' --columns[count].stage filtered --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price --columns[count].window.sort_keys price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 4 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 3, + 200, + 1 + ], + [ + 1, + 200, + 2 + ], + [ + 2, + 300, + 2 + ], + [ + 3, + 300, + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.test (+35 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/stage/filtered/window_function/window_count/group_sort.test 2019-04-22 17:10:48 +0900 (4cd4fc696) @@ -0,0 +1,35 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +logical_select Logs \ + --shard_key timestamp \ + --filter 'price > 100' \ + --columns[count].stage filtered \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.expected (+91 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.expected 2019-04-22 17:10:48 +0900 (2c8905f0c) @@ -0,0 +1,91 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 300} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 500}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 600} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.sort_keys price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 1, + 100, + 1 + ], + [ + 2, + 200, + 2 + ], + [ + 3, + 300, + 3 + ], + [ + 1, + 400, + 4 + ], + [ + 2, + 500, + 5 + ], + [ + 3, + 600, + 6 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.test (+34 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/ascending.test 2019-04-22 17:10:48 +0900 (390bebe12) @@ -0,0 +1,34 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 300} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 500}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 600} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.expected (+91 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.expected 2019-04-22 17:10:48 +0900 (bc1e17e4a) @@ -0,0 +1,91 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/15 02:00:00", "n_likes": 2, "price": 300} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 500}, +{"timestamp": "2017/04/16 12:00:00", "n_likes": 1, "price": 600} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.sort_keys -price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 1, + 100, + 6 + ], + [ + 2, + 200, + 5 + ], + [ + 3, + 300, + 4 + ], + [ + 1, + 400, + 3 + ], + [ + 2, + 500, + 2 + ], + [ + 3, + 600, + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.test (+34 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/descending.test 2019-04-22 17:10:48 +0900 (23d90b6e7) @@ -0,0 +1,34 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/15 02:00:00", "n_likes": 2, "price": 300} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 400}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 500}, +{"timestamp": "2017/04/16 12:00:00", "n_likes": 1, "price": 600} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.sort_keys -price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.expected (+91 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.expected 2019-04-22 17:10:48 +0900 (ce176e47b) @@ -0,0 +1,91 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.sort_keys n_likes --output_columns _id,n_likes,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "n_likes", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 1, + 2, + 2 + ], + [ + 2, + 1, + 1 + ], + [ + 3, + 2, + 3 + ], + [ + 1, + 1, + 4 + ], + [ + 2, + 2, + 6 + ], + [ + 3, + 1, + 5 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.test (+34 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/differnt_order_sort_keys_and_shar_keys.test 2019-04-22 17:10:48 +0900 (975e72eae) @@ -0,0 +1,34 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.sort_keys n_likes \ + --output_columns _id,n_likes,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.expected (+95 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.expected 2019-04-22 17:10:48 +0900 (9505deed7) @@ -0,0 +1,95 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price,name --output_columns price,name,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "price", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "count", + "UInt32" + ] + ], + [ + 100, + "item1", + 2 + ], + [ + 100, + "item1", + 2 + ], + [ + 200, + "item2", + 2 + ], + [ + 200, + "item2", + 2 + ], + [ + 300, + "item3", + 1 + ], + [ + 300, + "item5", + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.test (+36 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_no_sort.test 2019-04-22 17:10:48 +0900 (6aecaaa24) @@ -0,0 +1,36 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170415 name COLUMN_SCALAR ShortText + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170416 name COLUMN_SCALAR ShortText + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price,name \ + --output_columns price,name,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.expected (+105 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.expected 2019-04-22 17:10:48 +0900 (af056be42) @@ -0,0 +1,105 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 name COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price,name --columns[count].window.sort_keys price --output_columns _id,price,name,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "name", + "ShortText" + ], + [ + "count", + "UInt32" + ] + ], + [ + 1, + 100, + "item1", + 1 + ], + [ + 2, + 100, + "item1", + 2 + ], + [ + 3, + 200, + "item2", + 1 + ], + [ + 1, + 200, + "item2", + 2 + ], + [ + 2, + 300, + "item3", + 1 + ], + [ + 3, + 300, + "item5", + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.test (+37 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_multiple_keys_sort.test 2019-04-22 17:10:48 +0900 (3fb24b07c) @@ -0,0 +1,37 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170415 name COLUMN_SCALAR ShortText + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +column_create Logs_20170416 name COLUMN_SCALAR ShortText + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100, "name": "item1"}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200, "name": "item2"} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200, "name": "item2"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300, "name": "item3"}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300, "name": "item5"} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price,name \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,name,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.expected (+81 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.expected 2019-04-22 17:10:48 +0900 (0d2a758c7) @@ -0,0 +1,81 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price --output_columns price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 100, + 2 + ], + [ + 100, + 2 + ], + [ + 200, + 2 + ], + [ + 200, + 2 + ], + [ + 300, + 2 + ], + [ + 300, + 2 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.test (+34 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_no_sort.test 2019-04-22 17:10:48 +0900 (62be1c7a3) @@ -0,0 +1,34 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price \ + --output_columns price,count Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.expected (+91 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.expected 2019-04-22 17:10:48 +0900 (c547393c5) @@ -0,0 +1,91 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20170415 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +table_create Logs_20170416 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] +[[0,0.0,0.0],3] +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] +[[0,0.0,0.0],3] +logical_select Logs --shard_key timestamp --columns[count].stage initial --columns[count].type UInt32 --columns[count].flags COLUMN_SCALAR --columns[count].value 'window_count()' --columns[count].window.group_keys price --columns[count].window.sort_keys price --output_columns _id,price,count +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "price", + "UInt32" + ], + [ + "count", + "UInt32" + ] + ], + [ + 1, + 100, + 1 + ], + [ + 2, + 100, + 2 + ], + [ + 3, + 200, + 1 + ], + [ + 1, + 200, + 2 + ], + [ + 2, + 300, + 2 + ], + [ + 3, + 300, + 1 + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.test (+35 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/columns/window_function/window_count/group_sort.test 2019-04-22 17:10:48 +0900 (dfb9908c3) @@ -0,0 +1,35 @@ +plugin_register sharding + +table_create Logs_20170415 TABLE_NO_KEY +column_create Logs_20170415 timestamp COLUMN_SCALAR Time +column_create Logs_20170415 price COLUMN_SCALAR UInt32 +column_create Logs_20170415 n_likes COLUMN_SCALAR UInt32 + +table_create Logs_20170416 TABLE_NO_KEY +column_create Logs_20170416 timestamp COLUMN_SCALAR Time +column_create Logs_20170416 price COLUMN_SCALAR UInt32 +column_create Logs_20170416 n_likes COLUMN_SCALAR UInt32 + +load --table Logs_20170415 +[ +{"timestamp": "2017/04/15 00:00:00", "n_likes": 2, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 1, "price": 100}, +{"timestamp": "2017/04/15 01:00:00", "n_likes": 2, "price": 200} +] + +load --table Logs_20170416 +[ +{"timestamp": "2017/04/16 10:00:00", "n_likes": 1, "price": 200}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 2, "price": 300}, +{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 300} +] + +logical_select Logs \ + --shard_key timestamp \ + --columns[count].stage initial \ + --columns[count].type UInt32 \ + --columns[count].flags COLUMN_SCALAR \ + --columns[count].value 'window_count()' \ + --columns[count].window.group_keys price \ + --columns[count].window.sort_keys price \ + --output_columns _id,price,count Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.expected (+124 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.expected 2019-04-22 17:10:48 +0900 (5199ccc92) @@ -0,0 +1,124 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Items TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Items price COLUMN_SCALAR UInt32 +[[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 item COLUMN_SCALAR Items +[[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 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +table_create Logs_20170317 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170317 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +load --table Items +[ +{"_key": "item1", "price": 666}, +{"_key": "item2", "price": 999}, +{"_key": "item3", "price": 777}, +{"_key": "item4", "price": 111}, +{"_key": "item5", "price": 333}, +{"_key": "item6", "price": 222} +] +[[0,0.0,0.0],6] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] +[[0,0.0,0.0],2] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item3"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item4"} +] +[[0,0.0,0.0],2] +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item5"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item6"} +] +[[0,0.0,0.0],2] +logical_select Logs --shard_key timestamp --output_columns _id --limit 0 --drilldowns[item].keys item --drilldowns[item].columns[sun].stage initial --drilldowns[item].columns[sun].type UInt32 --drilldowns[item].columns[sun].flags COLUMN_SCALAR --drilldowns[item].columns[sun].value 'window_sum(price)' --drilldowns[item].columns[sun].window.sort_keys price --drilldowns[item].sort_keys 'sun' --drilldowns[item].output_columns 'sun, _key, price' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "item": [ + [ + 6 + ], + [ + [ + "sun", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "price", + "UInt32" + ] + ], + [ + 111, + "item4", + 111 + ], + [ + 333, + "item6", + 222 + ], + [ + 666, + "item5", + 333 + ], + [ + 1332, + "item1", + 666 + ], + [ + 2109, + "item3", + 777 + ], + [ + 3108, + "item2", + 999 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/ascending.test 2019-04-22 17:10:48 +0900 (ad58b9ba7) @@ -0,0 +1,57 @@ +plugin_register sharding + +table_create Items TABLE_HASH_KEY ShortText +column_create Items price COLUMN_SCALAR UInt32 + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 item COLUMN_SCALAR Items + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 item COLUMN_SCALAR Items + +table_create Logs_20170317 TABLE_NO_KEY +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +column_create Logs_20170317 item COLUMN_SCALAR Items + +load --table Items +[ +{"_key": "item1", "price": 666}, +{"_key": "item2", "price": 999}, +{"_key": "item3", "price": 777}, +{"_key": "item4", "price": 111}, +{"_key": "item5", "price": 333}, +{"_key": "item6", "price": 222} +] + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item3"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item4"} +] + +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item5"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item6"} +] + +logical_select Logs \ + --shard_key timestamp \ + --output_columns _id \ + --limit 0 \ + --drilldowns[item].keys item \ + --drilldowns[item].columns[sun].stage initial \ + --drilldowns[item].columns[sun].type UInt32 \ + --drilldowns[item].columns[sun].flags COLUMN_SCALAR \ + --drilldowns[item].columns[sun].value 'window_sum(price)' \ + --drilldowns[item].columns[sun].window.sort_keys price \ + --drilldowns[item].sort_keys 'sun' \ + --drilldowns[item].output_columns 'sun, _key, price' Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.expected (+124 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.expected 2019-04-22 17:10:48 +0900 (183b1ea2a) @@ -0,0 +1,124 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Items TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Items price COLUMN_SCALAR UInt32 +[[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 item COLUMN_SCALAR Items +[[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 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +table_create Logs_20170317 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170317 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +load --table Items +[ +{"_key": "item1", "price": 666}, +{"_key": "item2", "price": 999}, +{"_key": "item3", "price": 777}, +{"_key": "item4", "price": 111}, +{"_key": "item5", "price": 333}, +{"_key": "item6", "price": 222} +] +[[0,0.0,0.0],6] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] +[[0,0.0,0.0],2] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item3"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item4"} +] +[[0,0.0,0.0],2] +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item5"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item6"} +] +[[0,0.0,0.0],2] +logical_select Logs --shard_key timestamp --output_columns _id --limit 0 --drilldowns[item].keys item --drilldowns[item].columns[sun].stage initial --drilldowns[item].columns[sun].type UInt32 --drilldowns[item].columns[sun].flags COLUMN_SCALAR --drilldowns[item].columns[sun].value 'window_sum(price)' --drilldowns[item].columns[sun].window.sort_keys -price --drilldowns[item].sort_keys 'sun' --drilldowns[item].output_columns 'sun, _key, price' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "item": [ + [ + 6 + ], + [ + [ + "sun", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "price", + "UInt32" + ] + ], + [ + 999, + "item2", + 999 + ], + [ + 1776, + "item3", + 777 + ], + [ + 2442, + "item1", + 666 + ], + [ + 2775, + "item5", + 333 + ], + [ + 2997, + "item6", + 222 + ], + [ + 3108, + "item4", + 111 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.test (+57 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/descending.test 2019-04-22 17:10:48 +0900 (7616b0eca) @@ -0,0 +1,57 @@ +plugin_register sharding + +table_create Items TABLE_HASH_KEY ShortText +column_create Items price COLUMN_SCALAR UInt32 + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 item COLUMN_SCALAR Items + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 item COLUMN_SCALAR Items + +table_create Logs_20170317 TABLE_NO_KEY +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +column_create Logs_20170317 item COLUMN_SCALAR Items + +load --table Items +[ +{"_key": "item1", "price": 666}, +{"_key": "item2", "price": 999}, +{"_key": "item3", "price": 777}, +{"_key": "item4", "price": 111}, +{"_key": "item5", "price": 333}, +{"_key": "item6", "price": 222} +] + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item3"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item4"} +] + +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item5"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item6"} +] + +logical_select Logs \ + --shard_key timestamp \ + --output_columns _id \ + --limit 0 \ + --drilldowns[item].keys item \ + --drilldowns[item].columns[sun].stage initial \ + --drilldowns[item].columns[sun].type UInt32 \ + --drilldowns[item].columns[sun].flags COLUMN_SCALAR \ + --drilldowns[item].columns[sun].value 'window_sum(price)' \ + --drilldowns[item].columns[sun].window.sort_keys -price \ + --drilldowns[item].sort_keys 'sun' \ + --drilldowns[item].output_columns 'sun, _key, price' Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.expected (+124 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.expected 2019-04-22 17:10:48 +0900 (aaa8d698f) @@ -0,0 +1,124 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Items TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Items price COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Items type COLUMN_SCALAR ShortText +[[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 item COLUMN_SCALAR Items +[[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 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +table_create Logs_20170317 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170317 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +load --table Items +[ +{"_key": "item1", "price": 100, "type": "C"}, +{"_key": "item2", "price": 200, "type": "A"}, +{"_key": "item3", "price": 200, "type": "A"}, +{"_key": "item4", "price": 300, "type": "B"}, +{"_key": "item5", "price": 300, "type": "C"}, +{"_key": "item6", "price": 400, "type": "A"} +] +[[0,0.0,0.0],6] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] +[[0,0.0,0.0],2] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item2"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item3"} +] +[[0,0.0,0.0],2] +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item3"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item4"} +] +[[0,0.0,0.0],2] +logical_select Logs --shard_key timestamp --output_columns _id --limit 0 --drilldowns[item].keys item --drilldowns[item].columns[sum].stage initial --drilldowns[item].columns[sum].type UInt32 --drilldowns[item].columns[sum].flags COLUMN_SCALAR --drilldowns[item].columns[sum].value 'window_sum(price)' --drilldowns[item].columns[sum].window.group_keys price --drilldowns[item].columns[sum].window.sort_keys _key --drilldowns[item].output_columns 'sum, _key, price, type' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "item": [ + [ + 4 + ], + [ + [ + "sum", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "price", + "UInt32" + ], + [ + "type", + "ShortText" + ] + ], + [ + 100, + "item1", + 100, + "C" + ], + [ + 200, + "item2", + 200, + "A" + ], + [ + 400, + "item3", + 200, + "A" + ], + [ + 300, + "item4", + 300, + "B" + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.test (+58 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys.test 2019-04-22 17:10:48 +0900 (b41e1e6bb) @@ -0,0 +1,58 @@ +plugin_register sharding + +table_create Items TABLE_HASH_KEY ShortText +column_create Items price COLUMN_SCALAR UInt32 +column_create Items type COLUMN_SCALAR ShortText + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 item COLUMN_SCALAR Items + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 item COLUMN_SCALAR Items + +table_create Logs_20170317 TABLE_NO_KEY +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +column_create Logs_20170317 item COLUMN_SCALAR Items + +load --table Items +[ +{"_key": "item1", "price": 100, "type": "C"}, +{"_key": "item2", "price": 200, "type": "A"}, +{"_key": "item3", "price": 200, "type": "A"}, +{"_key": "item4", "price": 300, "type": "B"}, +{"_key": "item5", "price": 300, "type": "C"}, +{"_key": "item6", "price": 400, "type": "A"} +] + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item2"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item3"} +] + +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item3"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item4"} +] + +logical_select Logs \ + --shard_key timestamp \ + --output_columns _id \ + --limit 0 \ + --drilldowns[item].keys item \ + --drilldowns[item].columns[sum].stage initial \ + --drilldowns[item].columns[sum].type UInt32 \ + --drilldowns[item].columns[sum].flags COLUMN_SCALAR \ + --drilldowns[item].columns[sum].value 'window_sum(price)' \ + --drilldowns[item].columns[sum].window.group_keys price \ + --drilldowns[item].columns[sum].window.sort_keys _key \ + --drilldowns[item].output_columns 'sum, _key, price, type' Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.expected (+114 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.expected 2019-04-22 17:10:48 +0900 (6e2e15255) @@ -0,0 +1,114 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Items TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Items price COLUMN_SCALAR UInt32 +[[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 item COLUMN_SCALAR Items +[[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 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +table_create Logs_20170317 TABLE_NO_KEY +[[0,0.0,0.0],true] +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +column_create Logs_20170317 item COLUMN_SCALAR Items +[[0,0.0,0.0],true] +load --table Items +[ +{"_key": "item1", "price": 100}, +{"_key": "item2", "price": 200}, +{"_key": "item3", "price": 200}, +{"_key": "item4", "price": 300}, +{"_key": "item5", "price": 300}, +{"_key": "item6", "price": 400} +] +[[0,0.0,0.0],6] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] +[[0,0.0,0.0],2] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item2"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item3"} +] +[[0,0.0,0.0],2] +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item3"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item4"} +] +[[0,0.0,0.0],2] +logical_select Logs --shard_key timestamp --output_columns _id --limit 0 --drilldowns[item].keys item --drilldowns[item].columns[sum].stage initial --drilldowns[item].columns[sum].type UInt32 --drilldowns[item].columns[sum].flags COLUMN_SCALAR --drilldowns[item].columns[sum].value 'window_sum(price)' --drilldowns[item].columns[sum].window.group_keys price --drilldowns[item].output_columns 'sum, _key, price' +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 6 + ], + [ + [ + "_id", + "UInt32" + ] + ] + ], + { + "item": [ + [ + 4 + ], + [ + [ + "sum", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "price", + "UInt32" + ] + ], + [ + 100, + "item1", + 100 + ], + [ + 400, + "item2", + 200 + ], + [ + 400, + "item3", + 200 + ], + [ + 300, + "item4", + 300 + ] + ] + } + ] +] Added: test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.test (+56 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/drilldowns/columns/window_function/window_sum/group_keys_no_sort.test 2019-04-22 17:10:48 +0900 (e1ec2e982) @@ -0,0 +1,56 @@ +plugin_register sharding + +table_create Items TABLE_HASH_KEY ShortText +column_create Items price COLUMN_SCALAR UInt32 + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 item COLUMN_SCALAR Items + +table_create Logs_20170316 TABLE_NO_KEY +column_create Logs_20170316 timestamp COLUMN_SCALAR Time +column_create Logs_20170316 item COLUMN_SCALAR Items + +table_create Logs_20170317 TABLE_NO_KEY +column_create Logs_20170317 timestamp COLUMN_SCALAR Time +column_create Logs_20170317 item COLUMN_SCALAR Items + +load --table Items +[ +{"_key": "item1", "price": 100}, +{"_key": "item2", "price": 200}, +{"_key": "item3", "price": 200}, +{"_key": "item4", "price": 300}, +{"_key": "item5", "price": 300}, +{"_key": "item6", "price": 400} +] + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "item": "item1"}, +{"timestamp": "2017/03/15 01:00:00", "item": "item2"} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 10:00:00", "item": "item2"}, +{"timestamp": "2017/03/16 11:00:00", "item": "item3"} +] + +load --table Logs_20170317 +[ +{"timestamp": "2017/03/17 20:00:00", "item": "item3"}, +{"timestamp": "2017/03/17 20:00:00", "item": "item4"} +] + +logical_select Logs \ + --shard_key timestamp \ + --output_columns _id \ + --limit 0 \ + --drilldowns[item].keys item \ + --drilldowns[item].columns[sum].stage initial \ + --drilldowns[item].columns[sum].type UInt32 \ + --drilldowns[item].columns[sum].flags COLUMN_SCALAR \ + --drilldowns[item].columns[sum].value 'window_sum(price)' \ + --drilldowns[item].columns[sum].window.group_keys price \ + --drilldowns[item].output_columns 'sum, _key, price'