Navigation Menu

Skip to content

Commit

Permalink
logical_select: fix a bug that dynamic columns aren't created
Browse files Browse the repository at this point in the history
It's occurred when no match case.
  • Loading branch information
kou committed Apr 10, 2017
1 parent 7abd4f7 commit 82a392e
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/sharding/logical_select.rb
Expand Up @@ -728,6 +728,12 @@ def execute_search
if @context.result_sets.empty?
result_set = HashTable.create(:flags => ObjectFlags::WITH_SUBREC,
:key_type => first_shard.table)
@context.dynamic_columns.each_initial do |dynamic_column|
dynamic_column.apply(result_set)
end
@context.dynamic_columns.each_filtered do |dynamic_column|
dynamic_column.apply(result_set)
end
@context.result_sets << result_set
end
end
Expand Down
@@ -0,0 +1,14 @@
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
[
]
[[0,0.0,0.0],0]
logical_select 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],[[[0],[["price","UInt32"],["price_with_tax","UInt32"]]]]]
@@ -0,0 +1,19 @@
#@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
[
]

logical_select 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 comments on commit 82a392e

Please sign in to comment.