Kouhei Sutou 2018-12-26 15:31:40 +0900 (Wed, 26 Dec 2018) Revision: 287e784e2248fb0f9bf052d76f844980eab84d2c https://github.com/groonga/groonga/commit/287e784e2248fb0f9bf052d76f844980eab84d2c Message: logical_select load_table: add a test for same _key case Added files: test/command/suite/sharding/logical_select/load_table/same_key.expected test/command/suite/sharding/logical_select/load_table/same_key.test Added: test/command/suite/sharding/logical_select/load_table/same_key.expected (+131 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/load_table/same_key.expected 2018-12-26 15:31:40 +0900 (72bfb7d1f) @@ -0,0 +1,131 @@ +plugin_register sharding +[[0,0.0,0.0],true] +table_create Logs_20150203 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Logs_20150203 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +table_create Logs_20150204 TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Logs_20150204 timestamp COLUMN_SCALAR Time +[[0,0.0,0.0],true] +table_create Logs TABLE_HASH_KEY ShortText +[[0,0.0,0.0],true] +column_create Logs original_id COLUMN_SCALAR UInt32 +[[0,0.0,0.0],true] +column_create Logs timestamp_text COLUMN_SCALAR ShortText +[[0,0.0,0.0],true] +load --table Logs_20150203 +[ +{ + "_key": "2015-02-03:1", + "timestamp": "2015-02-03 10:49:00" +}, +{ + "_key": "2015-02-03:2", + "timestamp": "2015-02-03 12:49:00" +} +] +[[0,0.0,0.0],2] +load --table Logs_20150204 +[ +{ + "_key": "2015-02-04:1", + "timestamp": "2015-02-04 00:00:00" +} +] +[[0,0.0,0.0],1] +logical_select --logical_table Logs --shard_key timestamp --load_table Logs --load_columns "original_id, timestamp_text" --load_values "_id, timestamp" +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "timestamp", + "Time" + ] + ], + [ + 1, + "2015-02-03:1", + 1422928140.0 + ], + [ + 2, + "2015-02-03:2", + 1422935340.0 + ], + [ + 1, + "2015-02-04:1", + 1422975600.0 + ] + ] + ] +] +select --table Logs +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + 3 + ], + [ + [ + "_id", + "UInt32" + ], + [ + "_key", + "ShortText" + ], + [ + "original_id", + "UInt32" + ], + [ + "timestamp_text", + "ShortText" + ] + ], + [ + 1, + "2015-02-03:1", + 1, + "1422928140000000" + ], + [ + 2, + "2015-02-03:2", + 2, + "1422935340000000" + ], + [ + 3, + "2015-02-04:1", + 1, + "1422975600000000" + ] + ] + ] +] Added: test/command/suite/sharding/logical_select/load_table/same_key.test (+42 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_select/load_table/same_key.test 2018-12-26 15:31:40 +0900 (f4c194140) @@ -0,0 +1,42 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create Logs_20150203 TABLE_HASH_KEY ShortText +column_create Logs_20150203 timestamp COLUMN_SCALAR Time + +table_create Logs_20150204 TABLE_HASH_KEY ShortText +column_create Logs_20150204 timestamp COLUMN_SCALAR Time + +table_create Logs TABLE_HASH_KEY ShortText +column_create Logs original_id COLUMN_SCALAR UInt32 +column_create Logs timestamp_text COLUMN_SCALAR ShortText + +load --table Logs_20150203 +[ +{ + "_key": "2015-02-03:1", + "timestamp": "2015-02-03 10:49:00" +}, +{ + "_key": "2015-02-03:2", + "timestamp": "2015-02-03 12:49:00" +} +] + +load --table Logs_20150204 +[ +{ + "_key": "2015-02-04:1", + "timestamp": "2015-02-04 00:00:00" +} +] + +logical_select \ + --logical_table Logs \ + --shard_key timestamp \ + --load_table Logs \ + --load_columns "original_id, timestamp_text" \ + --load_values "_id, timestamp" + +select --table Logs -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20181226/9ecea5a7/attachment-0001.html>