Class: Arrow::RecordBatch
Class Method Summary
collapse
Instance Method Summary
collapse
#each_record
#refer_input, #share_input
#[], #column_names, #columns, #each_column, #find_column, #select_columns
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/arrow/record-batch.rb', line 71
def method_missing(name, *args, &block)
if args.empty?
column = find_column(name)
return column if column
end
super
end
|
Class Method Details
.new(*args) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/arrow/record-batch.rb', line 29
def new(*args)
n_args = args.size
case n_args
when 1
raw_table_converter = RawTableConverter.new(args[0])
n_rows = raw_table_converter.n_rows
schema = raw_table_converter.schema
values = raw_table_converter.values
super(schema, n_rows, values)
when 2
schema, data = args
RecordBatchBuilder.build(schema, data)
when 3
super
else
message = "wrong number of arguments (given #{n_args}, expected 1..3)"
raise ArgumentError, message
end
end
|
Instance Method Details
#length ⇒ Object
53
|
# File 'lib/arrow/record-batch.rb', line 53
alias_method :length, :n_rows
|
#n_rows ⇒ Object
20
21
22
|
# File 'lib/arrow/jruby/record-batch.rb', line 20
def n_rows
raise NotImplementedError
end
|
#respond_to_missing?(name, include_private) ⇒ Boolean
66
67
68
69
|
# File 'lib/arrow/record-batch.rb', line 66
def respond_to_missing?(name, include_private)
return true if find_column(name)
super
end
|
#size ⇒ Object
52
|
# File 'lib/arrow/record-batch.rb', line 52
alias_method :size, :n_rows
|
Converts the record batch to Table.
60
61
62
63
64
|
# File 'lib/arrow/record-batch.rb', line 60
def to_table
table = Table.new(schema, [self])
share_input(table)
table
end
|