Navigation Menu

Skip to content

Commit

Permalink
Fixed the update method of key_name and the condition to sort `resu…
Browse files Browse the repository at this point in the history
…lt_sets` in reverse order
  • Loading branch information
komainu8 committed Oct 26, 2017
1 parent 7e2b7cf commit abcb4f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/mrb/scripts/table.rb
Expand Up @@ -102,7 +102,7 @@ def ensure_sort_key(key, converted_keys)
order = key[:order] || order
offset = key[:offset] || offset
else
key_name = key.dup
key_name = key
end

case key_name
Expand All @@ -117,10 +117,10 @@ def ensure_sort_key(key, converted_keys)
end

if key_name.start_with?("-")
key_name[0] = ""
key_name = key_name[1..-1]
order = :descending
elsif key_name.start_with?("+")
key_name[0] = ""
key_name = key_name[1..-1]
end

key = find_column(key_name)
Expand Down
4 changes: 1 addition & 3 deletions plugins/sharding/logical_select.rb
Expand Up @@ -152,10 +152,8 @@ def write_records(writer, context)
:offset => current_offset,
:limit => current_limit,
}
context.sort_keys.each do |sort_key|
if sort_key.match("-timestamp")
if context.sort_keys.any? {|sort_key| sort_key.start_with?("-")}
result_sets = result_sets.reverse
end
end
result_sets.each do |result_set|
if result_set.size > current_offset
Expand Down

0 comments on commit abcb4f4

Please sign in to comment.