Class: RBHive::ResultSet

Inherits:
Array
  • Object
show all
Defined in:
lib/rbhive/result_set.rb

Direct Known Subclasses

TCLIResultSet

Instance Method Summary collapse

Constructor Details

#initialize(rows, schema) ⇒ ResultSet

Returns a new instance of ResultSet



3
4
5
6
# File 'lib/rbhive/result_set.rb', line 3

def initialize(rows, schema)
  @schema = schema
  super(rows.map {|r| @schema.coerce_row(r) })
end

Instance Method Details

#as_arraysObject



24
25
26
# File 'lib/rbhive/result_set.rb', line 24

def as_arrays
  @as_arrays ||= self.map{ |r| @schema.coerce_row_to_array(r) }
end

#column_namesObject



8
9
10
# File 'lib/rbhive/result_set.rb', line 8

def column_names
  @schema.column_names
end

#column_type_mapObject



12
13
14
# File 'lib/rbhive/result_set.rb', line 12

def column_type_map
  @schema.column_type_map
end

#to_csv(out_file = nil) ⇒ Object



16
17
18
# File 'lib/rbhive/result_set.rb', line 16

def to_csv(out_file=nil)
  to_separated_output(",", out_file)
end

#to_tsv(out_file = nil) ⇒ Object



20
21
22
# File 'lib/rbhive/result_set.rb', line 20

def to_tsv(out_file=nil)
  to_separated_output("\t", out_file)
end