Yasuhiro Horimoto
null+****@clear*****
Thu Mar 15 10:57:31 JST 2018
Yasuhiro Horimoto 2018-03-15 10:57:31 +0900 (Thu, 15 Mar 2018) New Revision: be18839528b44fcd7c2edba0099dc7ef1de620c8 https://github.com/groonga/groonga/commit/be18839528b44fcd7c2edba0099dc7ef1de620c8 Merged 4498a8f: Merge pull request #832 from komainu8/support_decimal_point Message: logical_range_filter: Support decimal point Added files: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.expected test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.test test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.expected test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.test test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.expected test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.test Modified files: plugins/sharding/logical_range_filter.rb Modified: plugins/sharding/logical_range_filter.rb (+1 -1) =================================================================== --- plugins/sharding/logical_range_filter.rb 2018-03-09 10:10:36 +0900 (5cde22a94) +++ plugins/sharding/logical_range_filter.rb 2018-03-15 10:57:31 +0900 (b070bf592) @@ -420,7 +420,7 @@ module Groonga format = "%04d/%02d/%02d %02d:%02d:%02d" format_values = [@year, @month, @day, @hour, @minute, @second] unles****@micro*****? - format << "%06d" + format << ".%06d" format_values << @microsecond end format % format_values Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.expected (+90 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.expected 2018-03-15 10:57:31 +0900 (de0546cef) @@ -0,0 +1,90 @@ +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] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] +[[0,0.0,0.0],9] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] +[[0,0.0,0.0],4] +table_create Times TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +[[0,0.0,0.0],true] +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp +[[0,0.0,0.0],true] +log_level --level debug +[[0,0.0,0.0],true] +logical_range_filter Logs --max '2017/03/16 08:22:00.001' --max_border include --shard_key timestamp --columns[five_minute].stage filtered --columns[five_minute].type Time --columns[five_minute].flags COLUMN_SCALAR --columns[five_minute].value 'time_classify_minute(timestamp, 5)' --columns[n_records_per_five_minute].stage filtered --columns[n_records_per_five_minute].type UInt32 --columns[n_records_per_five_minute].flags COLUMN_SCALAR --columns[n_records_per_five_minute].value 'window_count()' --columns[n_records_per_five_minute].window.group_keys 'five_minute' --filter 'price >= 300' --post_filter 'n_records_per_five_minute >= 3' --offset 6 --limit 3 --output_columns _id,n_records_per_five_minute,price +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "_id", + "UInt32" + ], + [ + "n_records_per_five_minute", + "UInt32" + ], + [ + "price", + "UInt32" + ] + ], + [ + 9, + 4, + 710 + ], + [ + 1, + 3, + 800 + ], + [ + 2, + 3, + 400 + ] + ] +] +#|d| [logical_range_filter][select] <Logs_20170315>: dynamic columns are used +#|d| [logical_range_filter][window] <Logs_20170315>: [2017/03/15 07:00:00,2017/03/15 08:00:00) +#|d| [logical_range_filter][select] <Logs_20170316>: dynamic columns are used +#|d| [logical_range_filter][window] <Logs_20170316>: [2017/03/16 08:00:00,2017/03/16 08:22:00.001000] +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.test (+61 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/max_decimal_point.test 2018-03-15 10:57:31 +0900 (3c6ff7829) @@ -0,0 +1,61 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +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 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] + +table_create Times TABLE_PAT_KEY Time +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp + +#@add-important-log-levels debug +log_level --level debug +logical_range_filter Logs \ + --max '2017/03/16 08:22:00.001' \ + --max_border include \ + --shard_key timestamp \ + --columns[five_minute].stage filtered \ + --columns[five_minute].type Time \ + --columns[five_minute].flags COLUMN_SCALAR \ + --columns[five_minute].value 'time_classify_minute(timestamp, 5)' \ + --columns[n_records_per_five_minute].stage filtered \ + --columns[n_records_per_five_minute].type UInt32 \ + --columns[n_records_per_five_minute].flags COLUMN_SCALAR \ + --columns[n_records_per_five_minute].value 'window_count()' \ + --columns[n_records_per_five_minute].window.group_keys 'five_minute' \ + --filter 'price >= 300' \ + --post_filter 'n_records_per_five_minute >= 3' \ + --offset 6 \ + --limit 3 \ + --output_columns _id,n_records_per_five_minute,price +log_level --level notice +#@remove-important-log-levels debug Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.expected (+88 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.expected 2018-03-15 10:57:31 +0900 (d65e7cf27) @@ -0,0 +1,88 @@ +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] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] +[[0,0.0,0.0],9] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] +[[0,0.0,0.0],4] +table_create Times TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +[[0,0.0,0.0],true] +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp +[[0,0.0,0.0],true] +log_level --level debug +[[0,0.0,0.0],true] +logical_range_filter Logs --min '2017/03/15 07:01:00.000' --min_border include --shard_key timestamp --columns[five_minute].stage filtered --columns[five_minute].type Time --columns[five_minute].flags COLUMN_SCALAR --columns[five_minute].value 'time_classify_minute(timestamp, 5)' --columns[n_records_per_five_minute].stage filtered --columns[n_records_per_five_minute].type UInt32 --columns[n_records_per_five_minute].flags COLUMN_SCALAR --columns[n_records_per_five_minute].value 'window_count()' --columns[n_records_per_five_minute].window.group_keys 'five_minute' --filter 'price >= 300' --post_filter 'n_records_per_five_minute >= 3' --offset 1 --limit 3 --output_columns _id,n_records_per_five_minute,price +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "_id", + "UInt32" + ], + [ + "n_records_per_five_minute", + "UInt32" + ], + [ + "price", + "UInt32" + ] + ], + [ + 6, + 4, + 520 + ], + [ + 8, + 4, + 410 + ], + [ + 9, + 4, + 710 + ] + ] +] +#|d| [logical_range_filter][select] <Logs_20170315>: dynamic columns are used +#|d| [logical_range_filter][window] <Logs_20170315>: [2017/03/15 07:01:00,2017/03/15 08:00:00) +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.test (+61 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_decimal_point.test 2018-03-15 10:57:31 +0900 (72246b26f) @@ -0,0 +1,61 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +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 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] + +table_create Times TABLE_PAT_KEY Time +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp + +#@add-important-log-levels debug +log_level --level debug +logical_range_filter Logs \ + --min '2017/03/15 07:01:00.000' \ + --min_border include \ + --shard_key timestamp \ + --columns[five_minute].stage filtered \ + --columns[five_minute].type Time \ + --columns[five_minute].flags COLUMN_SCALAR \ + --columns[five_minute].value 'time_classify_minute(timestamp, 5)' \ + --columns[n_records_per_five_minute].stage filtered \ + --columns[n_records_per_five_minute].type UInt32 \ + --columns[n_records_per_five_minute].flags COLUMN_SCALAR \ + --columns[n_records_per_five_minute].value 'window_count()' \ + --columns[n_records_per_five_minute].window.group_keys 'five_minute' \ + --filter 'price >= 300' \ + --post_filter 'n_records_per_five_minute >= 3' \ + --offset 1 \ + --limit 3 \ + --output_columns _id,n_records_per_five_minute,price +log_level --level notice +#@remove-important-log-levels debug Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.expected (+95 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.expected 2018-03-15 10:57:31 +0900 (cfe673204) @@ -0,0 +1,95 @@ +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] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] +[[0,0.0,0.0],9] +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] +[[0,0.0,0.0],4] +table_create Times TABLE_PAT_KEY Time +[[0,0.0,0.0],true] +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +[[0,0.0,0.0],true] +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp +[[0,0.0,0.0],true] +log_level --level debug +[[0,0.0,0.0],true] +logical_range_filter Logs --min '2017/03/15 07:01:00.000' --min_border include --max '2017/03/16 08:22:00.001' --max_border include --shard_key timestamp --columns[five_minute].stage filtered --columns[five_minute].type Time --columns[five_minute].flags COLUMN_SCALAR --columns[five_minute].value 'time_classify_minute(timestamp, 5)' --columns[n_records_per_five_minute].stage filtered --columns[n_records_per_five_minute].type UInt32 --columns[n_records_per_five_minute].flags COLUMN_SCALAR --columns[n_records_per_five_minute].value 'window_count()' --columns[n_records_per_five_minute].window.group_keys 'five_minute' --filter 'price >= 300' --post_filter 'n_records_per_five_minute >= 3' --offset 3 --limit 4 --output_columns _id,n_records_per_five_minute,price +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "_id", + "UInt32" + ], + [ + "n_records_per_five_minute", + "UInt32" + ], + [ + "price", + "UInt32" + ] + ], + [ + 9, + 4, + 710 + ], + [ + 1, + 3, + 800 + ], + [ + 2, + 3, + 400 + ], + [ + 3, + 3, + 500 + ] + ] +] +#|d| [logical_range_filter][select] <Logs_20170315>: dynamic columns are used +#|d| [logical_range_filter][window] <Logs_20170315>: [2017/03/15 07:01:00,2017/03/15 08:00:00) +#|d| [logical_range_filter][select] <Logs_20170316>: dynamic columns are used +#|d| [logical_range_filter][window] <Logs_20170316>: [2017/03/16 08:00:00,2017/03/16 08:22:00.001000] +log_level --level notice +[[0,0.0,0.0],true] Added: test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.test (+63 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/columns/stage/filtered/window_function/day/min_max_decimal_point.test 2018-03-15 10:57:31 +0900 (f034e7526) @@ -0,0 +1,63 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +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 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 07:00:00", "price": 1000}, +{"timestamp": "2017/03/15 07:01:00", "price": 900}, +{"timestamp": "2017/03/15 07:02:00", "price": 300}, +{"timestamp": "2017/03/15 07:03:00", "price": 200}, +{"timestamp": "2017/03/15 07:10:00", "price": 530}, +{"timestamp": "2017/03/15 07:11:00", "price": 520}, +{"timestamp": "2017/03/15 07:12:00", "price": 110}, +{"timestamp": "2017/03/15 07:13:00", "price": 410}, +{"timestamp": "2017/03/15 07:14:00", "price": 710} +] + +load --table Logs_20170316 +[ +{"timestamp": "2017/03/16 08:20:00", "price": 800}, +{"timestamp": "2017/03/16 08:21:00", "price": 400}, +{"timestamp": "2017/03/16 08:22:00", "price": 500}, +{"timestamp": "2017/03/16 08:23:00", "price": 300} +] + +table_create Times TABLE_PAT_KEY Time +column_create Times logs_20170315 COLUMN_INDEX Logs_20170315 timestamp +column_create Times logs_20170316 COLUMN_INDEX Logs_20170316 timestamp + +#@add-important-log-levels debug +log_level --level debug +logical_range_filter Logs \ + --min '2017/03/15 07:01:00.000' \ + --min_border include \ + --max '2017/03/16 08:22:00.001' \ + --max_border include \ + --shard_key timestamp \ + --columns[five_minute].stage filtered \ + --columns[five_minute].type Time \ + --columns[five_minute].flags COLUMN_SCALAR \ + --columns[five_minute].value 'time_classify_minute(timestamp, 5)' \ + --columns[n_records_per_five_minute].stage filtered \ + --columns[n_records_per_five_minute].type UInt32 \ + --columns[n_records_per_five_minute].flags COLUMN_SCALAR \ + --columns[n_records_per_five_minute].value 'window_count()' \ + --columns[n_records_per_five_minute].window.group_keys 'five_minute' \ + --filter 'price >= 300' \ + --post_filter 'n_records_per_five_minute >= 3' \ + --offset 3 \ + --limit 4 \ + --output_columns _id,n_records_per_five_minute,price +log_level --level notice +#@remove-important-log-levels debug -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180315/7111b32c/attachment-0001.htm