Class: RubySnowflake::StreamingResult
- Inherits:
-
Result
- Object
- Result
- RubySnowflake::StreamingResult
show all
- Defined in:
- lib/ruby_snowflake/streaming_result.rb
Instance Attribute Summary
Attributes inherited from Result
#data
Instance Method Summary
collapse
Methods inherited from Result
#[]=, #columns, #first, #get_all_rows
Constructor Details
#initialize(partition_count, row_type_data, retreive_proc) ⇒ StreamingResult
Returns a new instance of StreamingResult.
9
10
11
12
|
# File 'lib/ruby_snowflake/streaming_result.rb', line 9
def initialize(partition_count, row_type_data, retreive_proc)
super(partition_count, row_type_data)
@retreive_proc = retreive_proc
end
|
Instance Method Details
#each ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/ruby_snowflake/streaming_result.rb', line 14
def each
return to_enum(:each) unless block_given?
thread_pool = Concurrent::FixedThreadPool.new 1
data.each_with_index do |_partition, index|
next_index = [index+1, data.size-1].min
if data[next_index].nil? data[next_index] = Concurrent::Future.execute(executor: thread_pool) do
@retreive_proc.call(next_index)
end
end
if data[index].is_a? Concurrent::Future
data[index] = data[index].value end
data[index].each do |row|
yield wrap_row(row)
end
end
end
|
#last ⇒ Object
41
42
43
|
# File 'lib/ruby_snowflake/streaming_result.rb', line 41
def last
not_implemented
end
|
#size ⇒ Object
37
38
39
|
# File 'lib/ruby_snowflake/streaming_result.rb', line 37
def size
not_implemented
end
|