Class: Arrow::ListDataType

Inherits:
Object
  • Object
show all
Defined in:
lib/arrow/list-data-type.rb

Instance Method Summary collapse

Constructor Details

#initialize(field) ⇒ ListDataType #initialize(description) ⇒ ListDataType #initialize(data_type) ⇒ ListDataType

Creates a new Arrow::ListDataType.

Overloads:

  • #initialize(field) ⇒ ListDataType

    Examples:

    Create a list data type with Field

    visible_field = Arrow::Field.new("visible", :boolean)
    Arrow::ListDataType.new(visible_field)

    Create a list data type with field description

    Arrow::ListDataType.new(name: "visible", type: :boolean)

    Parameters:

    • field (Arrow::Field, Hash)

      The field of the list data type. You can also specify field description by ‘Hash`.

      See Field.new how to specify field description.

  • #initialize(description) ⇒ ListDataType

    Examples:

    Create a list data type with Field

    visible_field = Arrow::Field.new("visible", :boolean)
    Arrow::ListDataType.new(field: visible_field)

    Create a list data type with field description

    Arrow::ListDataType.new(field: {name: "visible", type: :boolean})

    Parameters:

    • description (Hash)

      The description of the list data type. It must have ‘:field` value.

    Options Hash (description):

    • :field (Arrow::Field, Hash)

      The field of the list data type. You can also specify field description by ‘Hash`.

      See Field.new how to specify field description.

  • #initialize(data_type) ⇒ ListDataType

    Examples:

    Create a list data type with DataType

    Arrow::ListDataType.new(Arrow::BooleanDataType.new)

    Create a list data type with data type name as String

    Arrow::ListDataType.new("boolean")

    Create a list data type with data type name as Symbol

    Arrow::ListDataType.new(:boolean)

    Create a list data type with data type as Array

    Arrow::ListDataType.new([:time32, :milli])

    Parameters:

    • data_type (Arrow::DataType, String, Symbol, ::Array<String>, ::Array<Symbol>, Hash)

      The element data type of the list data type. A field is created with the default name ‘“item”` from the data type automatically.

      See DataType.resolve how to specify data type.



77
78
79
80
81
82
83
84
85
# File 'lib/arrow/list-data-type.rb', line 77

def initialize(arg)
  data_type = resolve_data_type(arg)
  if data_type
    field = Field.new(default_field_name, data_type)
  else
    field = resolve_field(arg)
  end
  initialize_raw(field)
end