Kouhei Sutou
null+****@clear*****
Mon Nov 6 16:01:00 JST 2017
Kouhei Sutou 2017-11-06 16:01:00 +0900 (Mon, 06 Nov 2017) New Revision: 2e49781f98e914a4bf12dfb804bf53c911ebfd81 https://github.com/groonga/groonga/commit/2e49781f98e914a4bf12dfb804bf53c911ebfd81 Message: logical_range_filter: support cache with dynamic columns Added files: test/command/suite/sharding/logical_range_filter/cache/columns/filtered.expected test/command/suite/sharding/logical_range_filter/cache/columns/filtered.test test/command/suite/sharding/logical_range_filter/cache/columns/initial.expected test/command/suite/sharding/logical_range_filter/cache/columns/initial.test Modified files: plugins/sharding/dynamic_columns.rb Modified: plugins/sharding/dynamic_columns.rb (+1 -1) =================================================================== --- plugins/sharding/dynamic_columns.rb 2017-11-06 12:26:54 +0900 (cf8fa1a52) +++ plugins/sharding/dynamic_columns.rb 2017-11-06 16:01:00 +0900 (a01651931) @@ -76,7 +76,7 @@ module Groonga contexts.sort_by(&:label).each do |context| key << "#{context.label}\0" key << "#{context.stage}\0" - key << "#{context.type}\0" + key << "#{context.type.name}\0" key << "#{context.flags}\0" key << "#{context.value}\0" key << "#{context.window_sort_keys.join(',')}\0" Added: test/command/suite/sharding/logical_range_filter/cache/columns/filtered.expected (+77 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/cache/columns/filtered.expected 2017-11-06 16:01:00 +0900 (5f3c323b9) @@ -0,0 +1,77 @@ +plugin_register sharding +[[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] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] +[[0,0.0,0.0],3] +logical_range_filter Logs --shard_key timestamp --filter '_id > 1' --columns[price_with_tax].stage filtered --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --output_columns price,price_with_tax +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "price", + "UInt32" + ], + [ + "price_with_tax", + "UInt32" + ] + ], + [ + 900, + 972 + ], + [ + 300, + 324 + ] + ] +] +#>logical_range_filter --columns[price_with_tax].flags "COLUMN_SCALAR" --columns[price_with_tax].stage "filtered" --columns[price_with_tax].type "UInt32" --columns[price_with_tax].value "price * 1.08" --filter "_id > 1" --logical_table "Logs" --output_columns "price,price_with_tax" --shard_key "timestamp" +#:000000000000000 filter(2) +#<000000000000000 rc=0 +logical_range_filter Logs --shard_key timestamp --filter '_id > 1' --columns[price_with_tax].stage filtered --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --output_columns price,price_with_tax +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "price", + "UInt32" + ], + [ + "price_with_tax", + "UInt32" + ] + ], + [ + 900, + 972 + ], + [ + 300, + 324 + ] + ] +] +#>logical_range_filter --columns[price_with_tax].flags "COLUMN_SCALAR" --columns[price_with_tax].stage "filtered" --columns[price_with_tax].type "UInt32" --columns[price_with_tax].value "price * 1.08" --filter "_id > 1" --logical_table "Logs" --output_columns "price,price_with_tax" --shard_key "timestamp" +#:000000000000000 cache(0) +#<000000000000000 rc=0 Added: test/command/suite/sharding/logical_range_filter/cache/columns/filtered.test (+35 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/cache/columns/filtered.test 2017-11-06 16:01:00 +0900 (b3d5e028c) @@ -0,0 +1,35 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 price COLUMN_SCALAR UInt32 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] + +#@sleep 1 + +#@collect-query-log true +logical_range_filter Logs \ + --shard_key timestamp \ + --filter '_id > 1' \ + --columns[price_with_tax].stage filtered \ + --columns[price_with_tax].type UInt32 \ + --columns[price_with_tax].flags COLUMN_SCALAR \ + --columns[price_with_tax].value 'price * 1.08' \ + --output_columns price,price_with_tax +logical_range_filter Logs \ + --shard_key timestamp \ + --filter '_id > 1' \ + --columns[price_with_tax].stage filtered \ + --columns[price_with_tax].type UInt32 \ + --columns[price_with_tax].flags COLUMN_SCALAR \ + --columns[price_with_tax].value 'price * 1.08' \ + --output_columns price,price_with_tax +#@collect-query-log false Added: test/command/suite/sharding/logical_range_filter/cache/columns/initial.expected (+85 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/cache/columns/initial.expected 2017-11-06 16:01:00 +0900 (84658d0ad) @@ -0,0 +1,85 @@ +plugin_register sharding +[[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] +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] +[[0,0.0,0.0],3] +logical_range_filter Logs --shard_key timestamp --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --output_columns price,price_with_tax +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "price", + "UInt32" + ], + [ + "price_with_tax", + "UInt32" + ] + ], + [ + 1000, + 1080 + ], + [ + 900, + 972 + ], + [ + 300, + 324 + ] + ] +] +#>logical_range_filter --columns[price_with_tax].flags "COLUMN_SCALAR" --columns[price_with_tax].stage "initial" --columns[price_with_tax].type "UInt32" --columns[price_with_tax].value "price * 1.08" --logical_table "Logs" --output_columns "price,price_with_tax" --shard_key "timestamp" +#:000000000000000 filter(3) +#<000000000000000 rc=0 +logical_range_filter Logs --shard_key timestamp --columns[price_with_tax].stage initial --columns[price_with_tax].type UInt32 --columns[price_with_tax].flags COLUMN_SCALAR --columns[price_with_tax].value 'price * 1.08' --output_columns price,price_with_tax +[ + [ + 0, + 0.0, + 0.0 + ], + [ + [ + [ + "price", + "UInt32" + ], + [ + "price_with_tax", + "UInt32" + ] + ], + [ + 1000, + 1080 + ], + [ + 900, + 972 + ], + [ + 300, + 324 + ] + ] +] +#>logical_range_filter --columns[price_with_tax].flags "COLUMN_SCALAR" --columns[price_with_tax].stage "initial" --columns[price_with_tax].type "UInt32" --columns[price_with_tax].value "price * 1.08" --logical_table "Logs" --output_columns "price,price_with_tax" --shard_key "timestamp" +#:000000000000000 cache(0) +#<000000000000000 rc=0 Added: test/command/suite/sharding/logical_range_filter/cache/columns/initial.test (+33 -0) 100644 =================================================================== --- /dev/null +++ test/command/suite/sharding/logical_range_filter/cache/columns/initial.test 2017-11-06 16:01:00 +0900 (c8d8c1830) @@ -0,0 +1,33 @@ +#@on-error omit +plugin_register sharding +#@on-error default + +table_create Logs_20170315 TABLE_NO_KEY +column_create Logs_20170315 timestamp COLUMN_SCALAR Time +column_create Logs_20170315 price COLUMN_SCALAR UInt32 + +load --table Logs_20170315 +[ +{"timestamp": "2017/03/15 00:00:00", "price": 1000}, +{"timestamp": "2017/03/15 01:00:00", "price": 900}, +{"timestamp": "2017/03/15 02:00:00", "price": 300} +] + +#@sleep 1 + +#@collect-query-log true +logical_range_filter Logs \ + --shard_key timestamp \ + --columns[price_with_tax].stage initial \ + --columns[price_with_tax].type UInt32 \ + --columns[price_with_tax].flags COLUMN_SCALAR \ + --columns[price_with_tax].value 'price * 1.08' \ + --output_columns price,price_with_tax +logical_range_filter Logs \ + --shard_key timestamp \ + --columns[price_with_tax].stage initial \ + --columns[price_with_tax].type UInt32 \ + --columns[price_with_tax].flags COLUMN_SCALAR \ + --columns[price_with_tax].value 'price * 1.08' \ + --output_columns price,price_with_tax +#@collect-query-log false -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20171106/948c4633/attachment-0001.htm