Skip to content

Commit

Permalink
v1.3.3
Browse files Browse the repository at this point in the history
[feature] increase batch size from 10 to 100 ;
[fix] use Arrow::MapArrayBuilder.build to avoid segmentation fault.
  • Loading branch information
saluzafa committed Nov 13, 2021
1 parent fddf63a commit 912ac18
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
parqueteur (1.3.2)
parqueteur (1.3.3)
red-parquet (~> 6.0)

GEM
Expand Down
7 changes: 5 additions & 2 deletions examples/hello-world.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'securerandom'
require 'bundler/setup'
require 'parqueteur'

Expand All @@ -17,14 +18,16 @@ class FooParquetConverter < Parqueteur::Converter
column :my_timestamp, :timestamp
end

data = 100.times.collect do |i|
data = 1000.times.collect do |i|
{
'id' => i,
'my_string_array' => %w[a b c],
'my_date' => Date.today,
'my_decimal' => BigDecimal('0.03'),
'my_int' => rand(1..10),
'my_map' => { 'a' => 'b' },
'my_map' => 20.times.each_with_object({}) do |idx, hash|
hash["k_#{idx}"] = SecureRandom.urlsafe_base64(64)
end,
'my_string' => 'Hello World',
'my_struct' => {
'my_struct_str' => 'Hello World',
Expand Down
2 changes: 1 addition & 1 deletion lib/parqueteur/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Parqueteur
class Converter
DEFAULT_BATCH_SIZE = 10
DEFAULT_BATCH_SIZE = 100

def self.inline(&block)
Class.new(self, &block)
Expand Down
13 changes: 1 addition & 12 deletions lib/parqueteur/types/map_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@ module Parqueteur
module Types
class MapType < Parqueteur::Type
def build_value_array(values)
builder = Arrow::MapArrayBuilder.new(arrow_type)
values.each do |entry|
builder.append_value
next if entry.nil?

entry.each do |k, v|
builder.key_builder.append(k)
builder.item_builder.append(v)
end
end

builder.finish
Arrow::MapArrayBuilder.build(arrow_type, values)
end

def arrow_type_builder
Expand Down
2 changes: 1 addition & 1 deletion lib/parqueteur/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Parqueteur
VERSION = '1.3.2'
VERSION = '1.3.3'
end

0 comments on commit 912ac18

Please sign in to comment.