Module: Nanoarrow

Defined in:
lib/nanoarrow.rb,
lib/nanoarrow/array.rb,
lib/nanoarrow/types.rb,
lib/nanoarrow/utils.rb,
lib/nanoarrow/schema.rb,
lib/nanoarrow/version.rb,
lib/nanoarrow/iterator.rb,
lib/nanoarrow/array_stream.rb,
lib/nanoarrow/array_builder.rb,
ext/nanoarrow/ext.c

Defined Under Namespace

Modules: Type, Utils Classes: Array, ArrayBuilder, ArrayFromIterableBuilder, ArrayStream, ArrayViewBaseIterator, CArray, CArrayBuilder, CArrayStream, CArrayView, CBuffer, CMaterializedArrayStream, CSchema, CSchemaBuilder, CSchemaView, Capsule, Error, RbIterator, Schema, Todo

Constant Summary collapse

EPOCH =
Date.new(1970, 1, 1)
TIME_UNITS =
{"s" => 0, "ms" => 1, "us" => 2, "ns" => 3}
VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.binary(nullable: true) ⇒ Object



66
67
68
# File 'lib/nanoarrow/types.rb', line 66

def self.binary(nullable: true)
  Schema.new(Type::BINARY, nullable:)
end

.binary_view(nullable: true) ⇒ Object



74
75
76
# File 'lib/nanoarrow/types.rb', line 74

def self.binary_view(nullable: true)
  Schema.new(Type::BINARY_VIEW, nullable:)
end

.bool(nullable: true) ⇒ Object



6
7
8
# File 'lib/nanoarrow/types.rb', line 6

def self.bool(nullable: true)
  Schema.new(Type::BOOL, nullable:)
end

.date32(nullable: true) ⇒ Object



82
83
84
# File 'lib/nanoarrow/types.rb', line 82

def self.date32(nullable: true)
  Schema.new(Type::DATE32, nullable:)
end

.date64(nullable: true) ⇒ Object



86
87
88
# File 'lib/nanoarrow/types.rb', line 86

def self.date64(nullable: true)
  Schema.new(Type::DATE64, nullable:)
end

.decimal128(precision, scale, nullable: true) ⇒ Object



118
119
120
# File 'lib/nanoarrow/types.rb', line 118

def self.decimal128(precision, scale, nullable: true)
  Schema.new(Type::DECIMAL128, precision:, scale:, nullable:)
end

.decimal256(precision, scale, nullable: true) ⇒ Object



122
123
124
# File 'lib/nanoarrow/types.rb', line 122

def self.decimal256(precision, scale, nullable: true)
  Schema.new(Type::DECIMAL256, precision:, scale:, nullable:)
end

.dense_union(fields, type_codes: nil, nullable: true) ⇒ Object



157
158
159
160
161
162
# File 'lib/nanoarrow/types.rb', line 157

def self.dense_union(fields, type_codes: nil, nullable: true)
  if type_codes.nil?
    type_codes = fields.size.times.to_a
  end
  Schema.new(Type::DENSE_UNION, fields:, type_codes:, nullable:)
end

.dictionary(index_type, value_type, dictionary_ordered: false) ⇒ Object



146
147
148
# File 'lib/nanoarrow/types.rb', line 146

def self.dictionary(index_type, value_type, dictionary_ordered: false)
  Schema.new(Type::DICTIONARY, index_type:, value_type:, dictionary_ordered:)
end

.double(nullable: true) ⇒ Object



50
51
52
# File 'lib/nanoarrow/types.rb', line 50

def self.double(nullable: true)
  Schema.new(Type::DOUBLE, nullable:)
end

.duration(unit, nullable: true) ⇒ Object



102
103
104
# File 'lib/nanoarrow/types.rb', line 102

def self.duration(unit, nullable: true)
  Schema.new(Type::DURATION, unit:, nullable:)
end

.fixed_size_binary(byte_width, nullable: true) ⇒ Object



78
79
80
# File 'lib/nanoarrow/types.rb', line 78

def self.fixed_size_binary(byte_width, nullable: true)
  Schema.new(Type::FIXED_SIZE_BINARY, byte_width:, nullable:)
end

.fixed_size_list(value_type, list_size, nullable: true) ⇒ Object



138
139
140
# File 'lib/nanoarrow/types.rb', line 138

def self.fixed_size_list(value_type, list_size, nullable: true)
  Schema.new(Type::FIXED_SIZE_LIST, value_type:, list_size:, nullable:)
end

.float(nullable: true) ⇒ Object



46
47
48
# File 'lib/nanoarrow/types.rb', line 46

def self.float(nullable: true)
  Schema.new(Type::FLOAT, nullable:)
end

.half_float(nullable: true) ⇒ Object



42
43
44
# File 'lib/nanoarrow/types.rb', line 42

def self.half_float(nullable: true)
  Schema.new(Type::HALF_FLOAT, nullable:)
end

.int16(nullable: true) ⇒ Object



18
19
20
# File 'lib/nanoarrow/types.rb', line 18

def self.int16(nullable: true)
  Schema.new(Type::INT16, nullable:)
end

.int32(nullable: true) ⇒ Object



26
27
28
# File 'lib/nanoarrow/types.rb', line 26

def self.int32(nullable: true)
  Schema.new(Type::INT32, nullable:)
end

.int64(nullable: true) ⇒ Object



34
35
36
# File 'lib/nanoarrow/types.rb', line 34

def self.int64(nullable: true)
  Schema.new(Type::INT64, nullable:)
end

.int8(nullable: true) ⇒ Object



10
11
12
# File 'lib/nanoarrow/types.rb', line 10

def self.int8(nullable: true)
  Schema.new(Type::INT8, nullable:)
end

.interval_day_time(nullable: true) ⇒ Object



110
111
112
# File 'lib/nanoarrow/types.rb', line 110

def self.interval_day_time(nullable: true)
  Schema.new(Type::INTERVAL_DAY_TIME, nullable:)
end

.interval_month_day_nano(nullable: true) ⇒ Object



114
115
116
# File 'lib/nanoarrow/types.rb', line 114

def self.interval_month_day_nano(nullable: true)
  Schema.new(Type::INTERVAL_MONTH_DAY_NANO, nullable:)
end

.interval_months(nullable: true) ⇒ Object



106
107
108
# File 'lib/nanoarrow/types.rb', line 106

def self.interval_months(nullable: true)
  Schema.new(Type::INTERVAL_MONTHS, nullable:)
end

.large_binary(nullable: true) ⇒ Object



70
71
72
# File 'lib/nanoarrow/types.rb', line 70

def self.large_binary(nullable: true)
  Schema.new(Type::LARGE_BINARY, nullable:)
end

.large_list(value_type, nullable: true) ⇒ Object



134
135
136
# File 'lib/nanoarrow/types.rb', line 134

def self.large_list(value_type, nullable: true)
  Schema.new(Type::LARGE_LIST, value_type:, nullable:)
end

.large_string(nullable: true) ⇒ Object



58
59
60
# File 'lib/nanoarrow/types.rb', line 58

def self.large_string(nullable: true)
  Schema.new(Type::LARGE_STRING, nullable:)
end

.list(value_type, nullable: true) ⇒ Object



130
131
132
# File 'lib/nanoarrow/types.rb', line 130

def self.list(value_type, nullable: true)
  Schema.new(Type::LIST, value_type:, nullable:)
end

.map(key_type, value_type, keys_sorted: false, nullable: true) ⇒ Object



142
143
144
# File 'lib/nanoarrow/types.rb', line 142

def self.map(key_type, value_type, keys_sorted: false, nullable: true)
  Schema.new(Type::MAP, key_type:, value_type:, keys_sorted:, nullable:)
end

.null(nullable: true) ⇒ Object



2
3
4
# File 'lib/nanoarrow/types.rb', line 2

def self.null(nullable: true)
  Schema.new(Type::NULL, nullable:)
end

.sparse_union(fields, type_codes: nil, nullable: true) ⇒ Object



150
151
152
153
154
155
# File 'lib/nanoarrow/types.rb', line 150

def self.sparse_union(fields, type_codes: nil, nullable: true)
  if type_codes.nil?
    type_codes = fields.size.times.to_a
  end
  Schema.new(Type::SPARSE_UNION, fields:, type_codes:, nullable:)
end

.string(nullable: true) ⇒ Object



54
55
56
# File 'lib/nanoarrow/types.rb', line 54

def self.string(nullable: true)
  Schema.new(Type::STRING, nullable:)
end

.string_view(nullable: true) ⇒ Object



62
63
64
# File 'lib/nanoarrow/types.rb', line 62

def self.string_view(nullable: true)
  Schema.new(Type::STRING_VIEW, nullable:)
end

.struct(fields, nullable: true) ⇒ Object



126
127
128
# File 'lib/nanoarrow/types.rb', line 126

def self.struct(fields, nullable: true)
  Schema.new(Type::STRUCT, fields:, nullable:)
end

.time32(unit, nullable: true) ⇒ Object



90
91
92
# File 'lib/nanoarrow/types.rb', line 90

def self.time32(unit, nullable: true)
  Schema.new(Type::TIME32, unit:, nullable:)
end

.time64(unit, nullable: true) ⇒ Object



94
95
96
# File 'lib/nanoarrow/types.rb', line 94

def self.time64(unit, nullable: true)
  Schema.new(Type::TIME64, unit:, nullable:)
end

.timestamp(unit, timezone: nil, nullable: true) ⇒ Object



98
99
100
# File 'lib/nanoarrow/types.rb', line 98

def self.timestamp(unit, timezone: nil, nullable: true)
  Schema.new(Type::TIMESTAMP, unit:, timezone:, nullable:)
end

.uint16(nullable: true) ⇒ Object



22
23
24
# File 'lib/nanoarrow/types.rb', line 22

def self.uint16(nullable: true)
  Schema.new(Type::UINT16, nullable:)
end

.uint32(nullable: true) ⇒ Object



30
31
32
# File 'lib/nanoarrow/types.rb', line 30

def self.uint32(nullable: true)
  Schema.new(Type::UINT32, nullable:)
end

.uint64(nullable: true) ⇒ Object



38
39
40
# File 'lib/nanoarrow/types.rb', line 38

def self.uint64(nullable: true)
  Schema.new(Type::UINT64, nullable:)
end

.uint8(nullable: true) ⇒ Object



14
15
16
# File 'lib/nanoarrow/types.rb', line 14

def self.uint8(nullable: true)
  Schema.new(Type::UINT8, nullable:)
end