Class: Daru::TD::ResultProxy
- Inherits:
-
Object
- Object
- Daru::TD::ResultProxy
show all
- Defined in:
- lib/daru/td/result_proxy.rb
Defined Under Namespace
Classes: ContentDownloader
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(engine, job) ⇒ ResultProxy
Returns a new instance of ResultProxy.
11
12
13
14
15
|
# File 'lib/daru/td/result_proxy.rb', line 11
def initialize(engine, job)
@engine = engine
@job = job
@http = nil
end
|
Instance Attribute Details
#engine ⇒ Object
Returns the value of attribute engine.
17
18
19
|
# File 'lib/daru/td/result_proxy.rb', line 17
def engine
@engine
end
|
#job ⇒ Object
Returns the value of attribute job.
17
18
19
|
# File 'lib/daru/td/result_proxy.rb', line 17
def job
@job
end
|
Instance Method Details
#description ⇒ Object
30
31
32
33
34
35
|
# File 'lib/daru/td/result_proxy.rb', line 30
def description
if !job.finished?
job.wait()
end
job.hive_result_schema
end
|
#each_record(&block) ⇒ Object
42
43
44
|
# File 'lib/daru/td/result_proxy.rb', line 42
def each_record(&block)
MessagePack::Unpacker.new(self).each(&block)
end
|
#readpartial(len = 16384, outbuf = "") ⇒ Object
37
38
39
40
|
# File 'lib/daru/td/result_proxy.rb', line 37
def readpartial(len=16384, outbuf="")
@result_io ||= open_result_io()
@result_io.readpartial(len, outbuf)
end
|
#size ⇒ Object
23
24
25
26
27
28
|
# File 'lib/daru/td/result_proxy.rb', line 23
def size
if !job.finished?
job.wait()
end
job.result_size
end
|
#status ⇒ Object
19
20
21
|
# File 'lib/daru/td/result_proxy.rb', line 19
def status
job.status
end
|
#to_dataframe(parse_dates: nil) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/daru/td/result_proxy.rb', line 46
def to_dataframe(parse_dates: nil)
fields = description.map {|c| c[0].to_sym }
Daru::DataFrame.new([], order: fields).tap do |df|
each_record do |record|
df.add_row(record)
end
if parse_dates
parse_date_fields(df, parse_dates)
end
if engine.clear_progress
IRuby::Display.clear_output()
end
end
end
|