Class: Fluent::Plugin::Arrow::StructFieldWrapper
- Inherits:
-
FieldWrapper
- Object
- FieldWrapper
- Fluent::Plugin::Arrow::StructFieldWrapper
- Defined in:
- lib/fluent/plugin/arrow/field_wrapper.rb
Instance Attribute Summary
Attributes inherited from FieldWrapper
#array_builder, #arrow_field, #children, #field, #name, #type
Instance Method Summary collapse
- #append(value) ⇒ Object
- #create_array_builder(from_parent = nil) ⇒ Object
- #create_arrow_data_type ⇒ Object
Methods inherited from FieldWrapper
build, #cast_value, #create_arrow_field, #finish, #initialize
Constructor Details
This class inherits a constructor from Fluent::Plugin::Arrow::FieldWrapper
Instance Method Details
#append(value) ⇒ Object
232 233 234 235 236 237 238 239 240 241 |
# File 'lib/fluent/plugin/arrow/field_wrapper.rb', line 232 def append(value) if value.nil? @array_builder.append_null else @array_builder.append value.each do |k, v| @children.find { |c| c.name == k }.append(v) end end end |
#create_array_builder(from_parent = nil) ⇒ Object
247 248 249 250 251 252 253 254 255 |
# File 'lib/fluent/plugin/arrow/field_wrapper.rb', line 247 def create_array_builder(from_parent = nil) if from_parent @array_builder = from_parent else @array_builder = ::Arrow::StructArrayBuilder.new(arrow_field.data_type) end @children.each_with_index { |c, i| c.create_array_builder(@array_builder.get_field_builder(i)) } end |
#create_arrow_data_type ⇒ Object
243 244 245 |
# File 'lib/fluent/plugin/arrow/field_wrapper.rb', line 243 def create_arrow_data_type ::Arrow::StructDataType.new(children.map(&:arrow_field)) end |