Class: Cassie::Statements::Execution::PartitionLinking::CursoringPolicy

Inherits:
SimplePolicy show all
Defined in:
lib/cassie/statements/execution/partition_linking/cursoring_policy.rb

Instance Method Summary collapse

Methods inherited from SimplePolicy

#next_key

Methods included from PolicyMethods

#end_of_partition?, #initialize, #link, #partition_available?, #prepare_execution

Instance Method Details

#adjust_limitObject



11
12
13
14
15
# File 'lib/cassie/statements/execution/partition_linking/cursoring_policy.rb', line 11

def adjust_limit
  return super unless peeking_execution.since_cursor
  # leave the limit to return all results
  # from latest partition
end

#combine_rows(rows_a, rows_b) ⇒ Object



6
7
8
9
# File 'lib/cassie/statements/execution/partition_linking/cursoring_policy.rb', line 6

def combine_rows(rows_a, rows_b)
  return super unless peeking_execution.since_cursor
  rows_b
end

#previous_key(current_key) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/cassie/statements/execution/partition_linking/cursoring_policy.rb', line 26

def previous_key(current_key)
  return super unless peeking_execution.since_cursor

  # linking while cursoring with since
  # should return results from latest partition
  last_key
end

#seek_partition?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
# File 'lib/cassie/statements/execution/partition_linking/cursoring_policy.rb', line 17

def seek_partition?
  return super unless peeking_execution.since_cursor
  raise "linking partitions only supported for descending orderings. Open an issue if you need this!" if ascending?

  # linking while cursoring with since
  # should return latest results
  current_key != last_key
end