Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #657 from kenhys/test-cache-columns-window-sort-keys
Browse files Browse the repository at this point in the history
test: add columns[NAME].window.sort_keys test case without cache

Patch by Kentaro Hayashi. Thanks!!!
  • Loading branch information
kou committed Apr 20, 2017
2 parents 693f167 + f0a03e4 commit 1885a6b
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
@@ -0,0 +1,112 @@
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": 4, "price": 100},
{"timestamp": "2017/04/15 01:00:00", "n_likes": 3, "price": 200}
]
[[0,0.0,0.0],2]
load --table Logs_20170416
[
{"timestamp": "2017/04/16 10:00:00", "n_likes": 2, "price": 300},
{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 400}
]
[[0,0.0,0.0],2]
logical_select Logs --shard_key timestamp --columns[sum].stage initial --columns[sum].type UInt32 --columns[sum].flags COLUMN_SCALAR --columns[sum].value 'window_sum(price)' --columns[sum].window.sort_keys price --output_columns price,sum
[
[
0,
0.0,
0.0
],
[
[
[
4
],
[
[
"price",
"UInt32"
],
[
"sum",
"UInt32"
]
],
[
100,
100
],
[
200,
300
],
[
300,
300
],
[
400,
700
]
]
]
]
logical_select Logs --shard_key timestamp --columns[sum].stage initial --columns[sum].type UInt32 --columns[sum].flags COLUMN_SCALAR --columns[sum].value 'window_sum(price)' --columns[sum].window.sort_keys n_likes --output_columns price,sum
[
[
0,
0.0,
0.0
],
[
[
[
4
],
[
[
"price",
"UInt32"
],
[
"sum",
"UInt32"
]
],
[
100,
300
],
[
200,
200
],
[
300,
700
],
[
400,
400
]
]
]
]
@@ -0,0 +1,43 @@
#@on-error omit
plugin_register sharding
#@on-error default

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": 4, "price": 100},
{"timestamp": "2017/04/15 01:00:00", "n_likes": 3, "price": 200}
]

load --table Logs_20170416
[
{"timestamp": "2017/04/16 10:00:00", "n_likes": 2, "price": 300},
{"timestamp": "2017/04/16 11:00:00", "n_likes": 1, "price": 400}
]

logical_select Logs \
--shard_key timestamp \
--columns[sum].stage initial \
--columns[sum].type UInt32 \
--columns[sum].flags COLUMN_SCALAR \
--columns[sum].value 'window_sum(price)' \
--columns[sum].window.sort_keys price \
--output_columns price,sum

logical_select Logs \
--shard_key timestamp \
--columns[sum].stage initial \
--columns[sum].type UInt32 \
--columns[sum].flags COLUMN_SCALAR \
--columns[sum].value 'window_sum(price)' \
--columns[sum].window.sort_keys n_likes \
--output_columns price,sum

0 comments on commit 1885a6b

Please sign in to comment.