Class: WisconsinBenchmark::TableGenerator
- Inherits:
-
Object
- Object
- WisconsinBenchmark::TableGenerator
- Defined in:
- lib/wisconsin-benchmark/table_generator.rb
Overview
Arrow::Table generator
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
-
#generate ⇒ Arrow::Table
Generate Scaled Wisconsin Benchmark dataset in Arrow::Table.
-
#initialize(size) ⇒ TableGenerator
constructor
Create Scaled Wisconsin Benchmark dataset object.
- #inspect ⇒ Object
Constructor Details
#initialize(size) ⇒ TableGenerator
Create Scaled Wisconsin Benchmark dataset object.
8 9 10 11 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 8 def initialize(size) @size = size @array = WisconsinBenchmark::ArrayGenerator.new(size) end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
13 14 15 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 13 def array @array end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
13 14 15 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 13 def size @size end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
13 14 15 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 13 def table @table end |
Instance Method Details
#generate ⇒ Arrow::Table
Generate Scaled Wisconsin Benchmark dataset in Arrow::Table.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 19 def generate unique1 = @array.unique1 onePercent = unique1 % 100 @table = Arrow::Table.new( [ [:unique1, unique1], [:unique2, @array.unique2], [:two, unique1 % 2], [:four, unique1 % 4], [:ten, unique1 % 10], [:twenty, unique1 % 20], [:onePercent, onePercent], [:tenPercent, unique1 % 10], [:twentyPercent, unique1 % 5], [:fiftyPercent, unique1 % 2], [:unique3, unique1], [:evenOnePercent, onePercent * 2], [:oddOnePercent, (onePercent * 2) + 1], [:stringu1, @array.stringu1], [:stringu2, @array.stringu2], [:string4, @array.string4], ] ) end |
#inspect ⇒ Object
45 46 47 |
# File 'lib/wisconsin-benchmark/table_generator.rb', line 45 def inspect "<#{self.class} (size=#{@size}, table=#{@table ? '#<Arrow::Table>' : 'nil'})>" end |