Class: SparkConnect::Types::ArrayType

Inherits:
DataType
  • Object
show all
Defined in:
lib/spark_connect/types.rb

Overview

An array type. ‘element_type` is the type of every element; `contains_null` indicates whether the array may contain `null` values.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataType

#hash, #inspect, #json, #to_s

Constructor Details

#initialize(element_type, contains_null: true) ⇒ ArrayType

Returns a new instance of ArrayType.



262
263
264
265
266
# File 'lib/spark_connect/types.rb', line 262

def initialize(element_type, contains_null: true)
  super()
  @element_type = element_type
  @contains_null = contains_null
end

Instance Attribute Details

#contains_nullObject (readonly)

Returns the value of attribute contains_null.



260
261
262
# File 'lib/spark_connect/types.rb', line 260

def contains_null
  @contains_null
end

#element_typeObject (readonly)

Returns the value of attribute element_type.



260
261
262
# File 'lib/spark_connect/types.rb', line 260

def element_type
  @element_type
end

Instance Method Details

#==(other) ⇒ Object



279
280
281
# File 'lib/spark_connect/types.rb', line 279

def ==(other)
  other.is_a?(ArrayType) && other.element_type == element_type && other.contains_null == contains_null
end

#json_valueObject



271
272
273
# File 'lib/spark_connect/types.rb', line 271

def json_value
  { "type" => "array", "elementType" => element_type.json_value, "containsNull" => contains_null }
end

#simple_stringObject



268
# File 'lib/spark_connect/types.rb', line 268

def simple_string = "array<#{element_type.simple_string}>"

#to_protoObject



275
276
277
# File 'lib/spark_connect/types.rb', line 275

def to_proto
  Types.wrap(array: Proto::DataType::Array.new(element_type: element_type.to_proto, contains_null: contains_null))
end

#type_nameObject



269
# File 'lib/spark_connect/types.rb', line 269

def type_name = "array"