💎
Red Arrow用のRBS(随時更新)
本当はgem_rbs_collectionにパッチを送るのがいいんだと思うけど、当座の目的を果たすために書いているだけで、不完全なのでそういうところに送りづらい・・・
red-arrow.rbs
module Arrow
class Table
include Arrow::RecordContainable
type join_type = :inner | :left_semi | :right_semi | :left_anti | :right_anti | :left_outer | :right_outer | :full_outer
def self.new: (::Array[Arrow::Column]) -> instance
| (Hash[String, Arrow::Array]) -> instance
| (Hash[String, Arrow::ChunkedArray]) -> instance
| (Hash[String, ::Array[untyped]]) -> instance
| (Arrow::Schema, ::Array[Arrow::Column]) -> instance
| (Arrow::Schema, ::Array[Arrow::Array]) -> instance
| (Arrow::Schema, ::Array[Arrow::RecordBatch]) -> instance
| (Arrow::Schema, ::Array[::Array[untyped]]) -> instance
def self.load: (String | _ToPath, ?::Hash[Symbol, Object]) -> instance
def schema: () -> Arrow::Schema
def columns: () -> ::Array[Arrow::Column]
def column_names:() -> ::Array[String]
def []: (String | Symbol name) -> Arrow::Column
| (Integer index) -> Arrow::Column
| (Range[Integer] range) -> instance
| (::Array[String | Symbol | Integer | Range[Integer]] selectors) -> instance
def join: (Arrow::Table right,
?type: join_type,
?left_suffix: String,
?right_suffix: String,
?left_outputs: ::Array[String | Symbol] | nil,
?right_outputs: ::Array[String | Symbol] | nil) -> instance
| (Arrow::Table right,
String | Symbol key,
?type: join_type,
?left_suffix: String,
?right_suffix: String,
?left_outputs: ::Array[String | Symbol] | nil,
?right_outputs: ::Array[String | Symbol] | nil) -> instance
| (Arrow::Table right,
::Array[String | Symbol] keys,
?type: join_type,
?left_suffix: String,
?right_suffix: String,
?left_outputs: ::Array[String | Symbol] | nil,
?right_outputs: ::Array[String | Symbol] | nil) -> instance
| (Arrow::Table right,
::Hash[:left | :right, String | Symbol | ::Array[String | Symbol]] keys,
?type: join_type,
?left_suffix: String,
?right_suffix: String,
?left_outputs: ::Array[String | Symbol] | nil,
?right_outputs: ::Array[String | Symbol] | nil) -> instance
def save: (String | _ToPath | URI::Generic, ?Hash[untyped, untyped] options) -> void
def each_record_batch: { (Arrow::RecordBatch) -> void } -> void
| () -> Enumerator[Arrow::RecordBatch]
end
class Schema
def self.new: (::Array[Arrow::Field]) -> instance # FIXME
def []: (String | Symbol name) -> Arrow::Field
| (Integer index) -> Arrow::Field
end
class DataType
end
class Column
def data_type: () -> Arrow::DataType
end
class Field
def self.new: (String | Symbol name, Arrow::DataType | Symbol data_type, ?bool nullable) -> instance # FIXME
end
class Array
end
class ChunkedArray
end
class Record
def []: (String | Symbol name) -> Object
| (Integer index) -> Object
def to_a -> Array[Object]
end
class RecordBatch
include Arrow::RecordContainable
end
module RecordContainable
include Enumerable[Arrow::Record]
alias each each_record # Actually alias_record :each, :each_record
def each_record: (?refuse_record: bool) { (Arrow::Record) -> void } -> void
| (?refuse_record: bool) -> Enumerator[Arrow::Record]
end
end
Discussion