nanoarrow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ #include <stdatomic.h>
2
+ #include <stdlib.h>
3
+
4
+ #include "ext.h"
5
+
6
+ struct rc {
7
+ void* ptr;
8
+ _Atomic int count;
9
+ void (*destructor)(void*);
10
+ };
11
+
12
+ rc_t* rc_new(void* ptr, void (*destructor)(void*))
13
+ {
14
+ rc_t* rc = malloc(sizeof(rc_t));
15
+ rc->ptr = ptr;
16
+ rc->count = 1;
17
+ rc->destructor = destructor;
18
+ return rc;
19
+ }
20
+
21
+ void rc_increment(rc_t* rc)
22
+ {
23
+ rc->count++;
24
+ }
25
+
26
+ void rc_decrement(rc_t* rc)
27
+ {
28
+ int count = --rc->count;
29
+ if (count == 0)
30
+ {
31
+ rc->destructor(rc->ptr);
32
+ free(rc);
33
+ }
34
+ }
@@ -0,0 +1,346 @@
1
+ #include <ruby/ruby.h>
2
+
3
+ #include "ext.h"
4
+ #include "nanoarrow/nanoarrow.h"
5
+
6
+ VALUE cCSchema;
7
+
8
+ static void schema_mark(void* ptr)
9
+ {
10
+ schema_t* schema = (schema_t*) ptr;
11
+ rb_gc_mark_movable(schema->base);
12
+ }
13
+
14
+ const rb_data_type_t schema_data_type = {
15
+ .wrap_struct_name = "Nanoarrow::CSchema",
16
+ .function = {
17
+ .dmark = schema_mark,
18
+ .dfree = RUBY_TYPED_DEFAULT_FREE,
19
+ },
20
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
21
+ };
22
+
23
+ static VALUE schema_allocate(VALUE klass)
24
+ {
25
+ schema_t* schema;
26
+ VALUE obj = TypedData_Make_Struct(klass, schema_t, &schema_data_type, schema);
27
+ schema->base = alloc_c_schema(&schema->ptr);
28
+ return obj;
29
+ }
30
+
31
+ static VALUE schema_import_from_c_capsule(VALUE klass, VALUE schema_capsule)
32
+ {
33
+ schema_t* schema;
34
+ VALUE obj = TypedData_Make_Struct(klass, schema_t, &schema_data_type, schema);
35
+ schema->base = schema_capsule;
36
+ schema->ptr = (struct ArrowSchema*) NUM2ULL(rb_funcall(schema_capsule, rb_intern("to_i"), 0));
37
+ return obj;
38
+ }
39
+
40
+ static VALUE schema_deep_dup(VALUE self)
41
+ {
42
+ schema_t* schema;
43
+ GetSchema(self, schema);
44
+
45
+ schema_t* out_ptr;
46
+ VALUE out = schema_allocate(cCSchema);
47
+ GetSchema(out, out_ptr);
48
+
49
+ int code = ArrowSchemaDeepCopy(schema->ptr, out_ptr->ptr);
50
+ raise_error_not_ok("ArrowSchemaDeepCopy()", code);
51
+ return out;
52
+ }
53
+
54
+ VALUE schema_assert_valid(VALUE self)
55
+ {
56
+ schema_t* schema;
57
+ GetSchema(self, schema);
58
+
59
+ if (schema->ptr == NULL)
60
+ rb_raise(rb_eRuntimeError, "schema is NULL");
61
+ if (schema->ptr->release == NULL)
62
+ rb_raise(rb_eRuntimeError, "schema is released");
63
+
64
+ return Qnil;
65
+ }
66
+
67
+ static VALUE schema_type_equals(VALUE self, VALUE other, VALUE check_nullability)
68
+ {
69
+ schema_t* self_ptr;
70
+ GetSchema(self, self_ptr);
71
+
72
+ schema_assert_valid(self);
73
+
74
+ schema_t* other_ptr;
75
+ GetSchema(other, other_ptr);
76
+
77
+ if (self_ptr->ptr == other_ptr->ptr)
78
+ return Qtrue;
79
+
80
+ // format
81
+
82
+ VALUE format = rb_funcall(self, rb_intern("format"), 0);
83
+ VALUE other_format = rb_funcall(other, rb_intern("format"), 0);
84
+
85
+ if (rb_equal(format, other_format) != Qtrue)
86
+ return Qfalse;
87
+
88
+ // flags
89
+
90
+ int64_t flags = NUM2LL(rb_funcall(self, rb_intern("flags"), 0));
91
+ int64_t other_flags = NUM2LL(rb_funcall(other, rb_intern("flags"), 0));
92
+
93
+ if (!RTEST(check_nullability))
94
+ {
95
+ flags &= ~ARROW_FLAG_NULLABLE;
96
+ other_flags &= ~ARROW_FLAG_NULLABLE;
97
+ }
98
+
99
+ if (flags != other_flags)
100
+ return Qfalse;
101
+
102
+ // children
103
+
104
+ int64_t n_children = NUM2LL(rb_funcall(self, rb_intern("n_children"), 0));
105
+ int64_t other_n_children = NUM2LL(rb_funcall(other, rb_intern("n_children"), 0));
106
+
107
+ if (n_children != other_n_children)
108
+ return Qfalse;
109
+
110
+ for (int64_t i = 0; i < n_children; i++)
111
+ {
112
+ VALUE child = rb_funcall(self, rb_intern("child"), 1, LL2NUM(i));
113
+ VALUE other_child = rb_funcall(other, rb_intern("child"), 1, LL2NUM(i));
114
+
115
+ if (schema_type_equals(child, other_child, check_nullability) != Qtrue)
116
+ return Qfalse;
117
+ }
118
+
119
+ // dictionary
120
+
121
+ VALUE dictionary = rb_funcall(self, rb_intern("dictionary"), 0);
122
+ VALUE other_dictionary = rb_funcall(other, rb_intern("dictionary"), 0);
123
+
124
+ if (NIL_P(dictionary) != NIL_P(other_dictionary))
125
+ return Qfalse;
126
+
127
+ if (!NIL_P(dictionary))
128
+ {
129
+ if (schema_type_equals(dictionary, other_dictionary, check_nullability) != Qtrue)
130
+ return Qfalse;
131
+ }
132
+
133
+ return Qtrue;
134
+ }
135
+
136
+ void assert_type_equal(VALUE actual, VALUE expected, VALUE check_nullability)
137
+ {
138
+ if (!rb_obj_is_instance_of(actual, cCSchema))
139
+ rb_raise(rb_eTypeError, "actual is not CSchema");
140
+
141
+ if (!rb_obj_is_instance_of(expected, cCSchema))
142
+ rb_raise(rb_eTypeError, "actual is not CSchema");
143
+
144
+ if (!RTEST(schema_type_equals(actual, expected, check_nullability)))
145
+ rb_raise(rb_eArgError, "schema mismatch");
146
+ }
147
+
148
+ static VALUE schema_format(VALUE self)
149
+ {
150
+ schema_t* schema;
151
+ GetSchema(self, schema);
152
+
153
+ schema_assert_valid(self);
154
+
155
+ return schema->ptr->format != NULL ? rb_utf8_str_new_cstr(schema->ptr->format) : Qnil;
156
+ }
157
+
158
+ static VALUE schema_name(VALUE self)
159
+ {
160
+ schema_t* schema;
161
+ GetSchema(self, schema);
162
+
163
+ schema_assert_valid(self);
164
+
165
+ return schema->ptr->name != NULL ? rb_utf8_str_new_cstr(schema->ptr->name) : Qnil;
166
+ }
167
+
168
+ static VALUE schema_flags(VALUE self)
169
+ {
170
+ schema_t* schema;
171
+ GetSchema(self, schema);
172
+
173
+ return LL2NUM(schema->ptr->flags);
174
+ }
175
+
176
+ static VALUE schema_metadata(VALUE self)
177
+ {
178
+ schema_t* schema;
179
+ GetSchema(self, schema);
180
+
181
+ schema_assert_valid(self);
182
+
183
+ if (schema->ptr->metadata == NULL)
184
+ return rb_hash_new();
185
+
186
+ struct ArrowMetadataReader reader;
187
+ int code = ArrowMetadataReaderInit(&reader, schema->ptr->metadata);
188
+ raise_error_not_ok("ArrowMetadataReaderInit()", code);
189
+
190
+ VALUE items = rb_hash_new_capa(reader.remaining_keys);
191
+ while (reader.remaining_keys > 0)
192
+ {
193
+ struct ArrowStringView key;
194
+ struct ArrowStringView value;
195
+ code = ArrowMetadataReaderRead(&reader, &key, &value);
196
+ raise_error_not_ok("ArrowMetadataReaderRead()", code);
197
+ rb_hash_aset(items, rb_str_new(key.data, key.size_bytes), rb_str_new(value.data, value.size_bytes));
198
+ }
199
+ return items;
200
+ }
201
+
202
+ static VALUE schema_n_children(VALUE self)
203
+ {
204
+ schema_t* schema;
205
+ GetSchema(self, schema);
206
+
207
+ schema_assert_valid(self);
208
+
209
+ return LL2NUM(schema->ptr->n_children);
210
+ }
211
+
212
+ static VALUE schema_child(VALUE self, VALUE rb_i)
213
+ {
214
+ schema_t* schema;
215
+ GetSchema(self, schema);
216
+
217
+ schema_assert_valid(self);
218
+
219
+ int64_t i = NUM2LL(rb_i);
220
+ if (i < 0 || i >= schema->ptr->n_children)
221
+ rb_raise(rb_eIndexError, "out of range");
222
+
223
+ schema_t* schema_ptr;
224
+ VALUE obj = TypedData_Make_Struct(cCSchema, schema_t, &schema_data_type, schema_ptr);
225
+ schema_ptr->base = schema->base;
226
+ schema_ptr->ptr = schema->ptr->children[i];
227
+ return obj;
228
+ }
229
+
230
+ static VALUE schema_dictionary(VALUE self)
231
+ {
232
+ schema_t* schema;
233
+ GetSchema(self, schema);
234
+
235
+ schema_assert_valid(self);
236
+
237
+ if (schema->ptr->dictionary != NULL)
238
+ raise_todo();
239
+
240
+ return Qnil;
241
+ }
242
+
243
+ static VALUE schema_to_s(VALUE self)
244
+ {
245
+ schema_t* schema;
246
+ GetSchema(self, schema);
247
+
248
+ int64_t n_chars = 1024;
249
+ bool recursive = true;
250
+
251
+ char* out = ArrowMalloc(n_chars + 1);
252
+ if (out == NULL)
253
+ rb_raise(rb_eNoMemError, "out of memory");
254
+
255
+ int64_t len = ArrowSchemaToString(schema->ptr, out, n_chars + 1, recursive);
256
+ VALUE out_str = rb_str_new(out, len);
257
+ ArrowFree(out);
258
+ return out_str;
259
+ }
260
+
261
+ static VALUE schema_arrow_c_schema(VALUE self)
262
+ {
263
+ schema_t* schema;
264
+ GetSchema(self, schema);
265
+
266
+ schema_assert_valid(self);
267
+
268
+ struct ArrowSchema* c_schema_out;
269
+ VALUE schema_capsule = alloc_c_schema(&c_schema_out);
270
+
271
+ int code = ArrowSchemaDeepCopy(schema->ptr, c_schema_out);
272
+ raise_error_not_ok("ArrowSchemaDeepCopy()", code);
273
+ return schema_capsule;
274
+ }
275
+
276
+ static VALUE schema_modify(VALUE self, VALUE format, VALUE name, VALUE flags, VALUE nullable, VALUE metadata, VALUE children, VALUE dictionary, VALUE validate)
277
+ {
278
+ VALUE builder = rb_funcall(cCSchemaBuilder, rb_intern("allocate"), 0);
279
+
280
+ if (NIL_P(format))
281
+ rb_funcall(builder, rb_intern("set_format"), 1, rb_funcall(self, rb_intern("format"), 0));
282
+ else
283
+ rb_funcall(builder, rb_intern("set_format"), 1, format);
284
+
285
+ if (NIL_P(name))
286
+ rb_funcall(builder, rb_intern("set_name"), 1, rb_funcall(self, rb_intern("name"), 0));
287
+ else
288
+ rb_funcall(builder, rb_intern("set_name"), 1, name);
289
+
290
+ if (NIL_P(flags))
291
+ rb_funcall(builder, rb_intern("set_flags"), 1, rb_funcall(self, rb_intern("flags"), 0));
292
+ else
293
+ rb_funcall(builder, rb_intern("set_flags"), 1, flags);
294
+
295
+ if (!NIL_P(nullable))
296
+ rb_funcall(builder, rb_intern("set_nullable"), 1, nullable);
297
+
298
+ if (NIL_P(metadata))
299
+ {
300
+ VALUE self_metadata = rb_funcall(self, rb_intern("metadata"), 0);
301
+ if (!NIL_P(self_metadata))
302
+ rb_funcall(builder, rb_intern("append_metadata"), 1, self_metadata);
303
+ }
304
+ else
305
+ rb_funcall(builder, rb_intern("append_metadata"), 1, metadata);
306
+
307
+ if (NIL_P(children))
308
+ {
309
+ if (NUM2LL(rb_funcall(self, rb_intern("n_children"), 0)) > 0)
310
+ raise_todo();
311
+ }
312
+ else
313
+ raise_todo();
314
+
315
+ if (NIL_P(dictionary))
316
+ {
317
+ if (!NIL_P(rb_funcall(self, rb_intern("dictionary"), 0)))
318
+ raise_todo();
319
+ }
320
+ else
321
+ raise_todo();
322
+
323
+ if (RTEST(validate))
324
+ rb_funcall(builder, rb_intern("validate"), 0);
325
+
326
+ return rb_funcall(builder, rb_intern("finish"), 0);
327
+ }
328
+
329
+ void Init_schema(void)
330
+ {
331
+ cCSchema = rb_define_class_under(mNanoarrow, "CSchema", rb_cObject);
332
+ rb_define_alloc_func(cCSchema, schema_allocate);
333
+ rb_define_singleton_method(cCSchema, "import_from_c_capsule", schema_import_from_c_capsule, 1);
334
+ rb_define_method(cCSchema, "deep_dup", schema_deep_dup, 0);
335
+ rb_define_method(cCSchema, "format", schema_format, 0);
336
+ rb_define_method(cCSchema, "name", schema_name, 0);
337
+ rb_define_method(cCSchema, "flags", schema_flags, 0);
338
+ rb_define_method(cCSchema, "metadata", schema_metadata, 0);
339
+ rb_define_method(cCSchema, "n_children", schema_n_children, 0);
340
+ rb_define_method(cCSchema, "child", schema_child, 1);
341
+ rb_define_method(cCSchema, "dictionary", schema_dictionary, 0);
342
+ rb_define_method(cCSchema, "to_s", schema_to_s, 0);
343
+ rb_define_method(cCSchema, "arrow_c_schema", schema_arrow_c_schema, 0);
344
+ rb_define_method(cCSchema, "modify", schema_modify, 8);
345
+ rb_define_method(cCSchema, "assert_valid", schema_assert_valid, 0);
346
+ }
@@ -0,0 +1,251 @@
1
+ #include <ruby/ruby.h>
2
+
3
+ #include "ext.h"
4
+ #include "nanoarrow/nanoarrow.h"
5
+
6
+ VALUE cCSchemaBuilder;
7
+
8
+ typedef struct schema_builder {
9
+ VALUE c_schema;
10
+ struct ArrowSchema* ptr;
11
+ } schema_builder_t;
12
+
13
+ static void schema_builder_mark(void* ptr)
14
+ {
15
+ schema_builder_t* builder = (schema_builder_t*) ptr;
16
+ rb_gc_mark_movable(builder->c_schema);
17
+ }
18
+
19
+ const rb_data_type_t schema_builder_data_type = {
20
+ .wrap_struct_name = "Nanoarrow::CSchemaBuilder",
21
+ .function = {
22
+ .dmark = schema_builder_mark,
23
+ .dfree = RUBY_TYPED_DEFAULT_FREE,
24
+ },
25
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY
26
+ };
27
+
28
+ VALUE schema_builder_allocate(VALUE klass)
29
+ {
30
+ schema_builder_t* builder;
31
+ VALUE obj = TypedData_Make_Struct(klass, schema_builder_t, &schema_builder_data_type, builder);
32
+
33
+ schema_t* schema_ptr;
34
+ VALUE schema = rb_funcall(cCSchema, rb_intern("allocate"), 0);
35
+ GetSchema(schema, schema_ptr);
36
+
37
+ builder->c_schema = schema;
38
+ builder->ptr = schema_ptr->ptr;
39
+ if (builder->ptr->release == NULL)
40
+ ArrowSchemaInit(builder->ptr);
41
+
42
+ return obj;
43
+ }
44
+
45
+ static int foreach_metadata(st_data_t key_data, st_data_t value_data, st_data_t buffer_data)
46
+ {
47
+ VALUE k = (VALUE) key_data;
48
+ VALUE v = (VALUE) value_data;
49
+ buffer_t* buffer;
50
+ GetBuffer((VALUE) buffer_data, buffer);
51
+
52
+ struct ArrowStringView key;
53
+ struct ArrowStringView value;
54
+
55
+ Check_Type(k, T_STRING);
56
+ key.data = StringValuePtr(k);
57
+ key.size_bytes = RSTRING_LEN(k);
58
+
59
+ Check_Type(v, T_STRING);
60
+ value.data = StringValuePtr(v);
61
+ value.size_bytes = RSTRING_LEN(v);
62
+
63
+ int code = ArrowMetadataBuilderAppend(buffer->ptr, key, value);
64
+ raise_error_not_ok("ArrowMetadataBuilderAppend()", code);
65
+
66
+ return ST_CONTINUE;
67
+ }
68
+
69
+ static VALUE schema_builder_append_metadata(VALUE self, VALUE metadata)
70
+ {
71
+ schema_builder_t* builder;
72
+ GetSchemaBuilder(self, builder);
73
+
74
+ Check_Type(metadata, T_HASH);
75
+
76
+ if (RHASH_SIZE(metadata) > 0)
77
+ {
78
+ VALUE buffer = rb_funcall(cCBuffer, rb_intern("empty"), 0);
79
+ buffer_t* buffer_ptr;
80
+ GetBuffer(buffer, buffer_ptr);
81
+
82
+ schema_t* c_schema;
83
+ GetSchema(builder->c_schema, c_schema);
84
+
85
+ const char* existing_metadata = c_schema->ptr->metadata;
86
+ int code = ArrowMetadataBuilderInit(buffer_ptr->ptr, existing_metadata);
87
+ raise_error_not_ok("ArrowMetadataBuilderInit()", code);
88
+
89
+ rb_hash_foreach(metadata, foreach_metadata, buffer);
90
+
91
+ code = ArrowSchemaSetMetadata(c_schema->ptr, (const char*) buffer_ptr->ptr->data);
92
+ raise_error_not_ok("ArrowSchemaSetMetadata()", code);
93
+ }
94
+
95
+ return self;
96
+ }
97
+
98
+ static VALUE schema_builder_set_type(VALUE self, VALUE type_id)
99
+ {
100
+ schema_builder_t* builder;
101
+ GetSchemaBuilder(self, builder);
102
+
103
+ schema_assert_valid(builder->c_schema);
104
+
105
+ int code = ArrowSchemaSetType(builder->ptr, NUM2INT(type_id));
106
+ raise_error_not_ok("ArrowSchemaSetType()", code);
107
+
108
+ return self;
109
+ }
110
+
111
+ static VALUE schema_builder_set_type_decimal(VALUE self, VALUE type_id, VALUE precision, VALUE scale)
112
+ {
113
+ schema_builder_t* builder;
114
+ GetSchemaBuilder(self, builder);
115
+
116
+ schema_assert_valid(builder->c_schema);
117
+
118
+ int code = ArrowSchemaSetTypeDecimal(builder->ptr, NUM2INT(type_id), NUM2INT(precision), NUM2INT(scale));
119
+ raise_error_not_ok("ArrowSchemaSetTypeDecimal()", code);
120
+
121
+ return self;
122
+ }
123
+
124
+ static VALUE schema_builder_set_type_fixed_size(VALUE self, VALUE type_id, VALUE fixed_size)
125
+ {
126
+ schema_builder_t* builder;
127
+ GetSchemaBuilder(self, builder);
128
+
129
+ schema_assert_valid(builder->c_schema);
130
+
131
+ int code = ArrowSchemaSetTypeFixedSize(builder->ptr, NUM2INT(type_id), NUM2INT(fixed_size));
132
+ raise_error_not_ok("ArrowSchemaSetTypeFixedSize()", code);
133
+
134
+ return self;
135
+ }
136
+
137
+ static VALUE schema_builder_set_type_date_time(VALUE self, VALUE type_id, VALUE time_unit, VALUE timezone)
138
+ {
139
+ schema_builder_t* builder;
140
+ GetSchemaBuilder(self, builder);
141
+
142
+ schema_assert_valid(builder->c_schema);
143
+
144
+ int code;
145
+ if (NIL_P(timezone))
146
+ code = ArrowSchemaSetTypeDateTime(builder->ptr, NUM2INT(type_id), NUM2INT(time_unit), NULL);
147
+ else
148
+ code = ArrowSchemaSetTypeDateTime(builder->ptr, NUM2INT(type_id), NUM2INT(time_unit), StringValueCStr(timezone));
149
+
150
+ raise_error_not_ok("ArrowSchemaSetTypeDateTime()", code);
151
+
152
+ return self;
153
+ }
154
+
155
+ static VALUE schema_builder_set_format(VALUE self, VALUE format)
156
+ {
157
+ schema_builder_t* builder;
158
+ GetSchemaBuilder(self, builder);
159
+
160
+ schema_assert_valid(builder->c_schema);
161
+
162
+ int code = ArrowSchemaSetFormat(builder->ptr, StringValueCStr(format));
163
+ raise_error_not_ok("ArrowSchemaSetFormat()", code);
164
+
165
+ return self;
166
+ }
167
+
168
+ static VALUE schema_builder_set_name(VALUE self, VALUE name)
169
+ {
170
+ schema_builder_t* builder;
171
+ GetSchemaBuilder(self, builder);
172
+
173
+ schema_assert_valid(builder->c_schema);
174
+
175
+ int code;
176
+ if (NIL_P(name))
177
+ code = ArrowSchemaSetName(builder->ptr, NULL);
178
+ else
179
+ code = ArrowSchemaSetName(builder->ptr, StringValueCStr(name));
180
+
181
+ raise_error_not_ok("ArrowSchemaSetName()", code);
182
+
183
+ return self;
184
+ }
185
+
186
+ static VALUE schema_builder_set_flags(VALUE self, VALUE flags)
187
+ {
188
+ schema_builder_t* builder;
189
+ GetSchemaBuilder(self, builder);
190
+
191
+ builder->ptr->flags = NUM2LL(flags);
192
+ return self;
193
+ }
194
+
195
+ static VALUE schema_builder_set_nullable(VALUE self, VALUE nullable)
196
+ {
197
+ schema_builder_t* builder;
198
+ GetSchemaBuilder(self, builder);
199
+
200
+ if (RTEST(nullable))
201
+ builder->ptr->flags |= ARROW_FLAG_NULLABLE;
202
+ else
203
+ builder->ptr->flags &= ~ARROW_FLAG_NULLABLE;
204
+
205
+ return self;
206
+ }
207
+
208
+ static VALUE schema_builder_validate(VALUE self)
209
+ {
210
+ schema_builder_t* builder;
211
+ GetSchemaBuilder(self, builder);
212
+
213
+ return rb_funcall(cCSchemaView, rb_intern("new"), 1, builder->c_schema);
214
+ }
215
+
216
+ static VALUE schema_builder_finish(VALUE self)
217
+ {
218
+ schema_builder_t* builder;
219
+ GetSchemaBuilder(self, builder);
220
+
221
+ schema_assert_valid(builder->c_schema);
222
+
223
+ VALUE out = rb_funcall(cCSchema, rb_intern("allocate"), 0);
224
+
225
+ schema_t* c_schema_ptr;
226
+ GetSchema(builder->c_schema, c_schema_ptr);
227
+
228
+ schema_t* out_ptr;
229
+ GetSchema(out, out_ptr);
230
+
231
+ ArrowSchemaMove(c_schema_ptr->ptr, out_ptr->ptr);
232
+ ArrowSchemaInit(c_schema_ptr->ptr);
233
+ return out;
234
+ }
235
+
236
+ void Init_schema_builder(void)
237
+ {
238
+ cCSchemaBuilder = rb_define_class_under(mNanoarrow, "CSchemaBuilder", rb_cObject);
239
+ rb_define_alloc_func(cCSchemaBuilder, schema_builder_allocate);
240
+ rb_define_method(cCSchemaBuilder, "append_metadata", schema_builder_append_metadata, 1);
241
+ rb_define_method(cCSchemaBuilder, "set_type", schema_builder_set_type, 1);
242
+ rb_define_method(cCSchemaBuilder, "set_type_decimal", schema_builder_set_type_decimal, 3);
243
+ rb_define_method(cCSchemaBuilder, "set_type_fixed_size", schema_builder_set_type_fixed_size, 2);
244
+ rb_define_method(cCSchemaBuilder, "set_type_date_time", schema_builder_set_type_date_time, 3);
245
+ rb_define_method(cCSchemaBuilder, "set_format", schema_builder_set_format, 1);
246
+ rb_define_method(cCSchemaBuilder, "set_name", schema_builder_set_name, 1);
247
+ rb_define_method(cCSchemaBuilder, "set_flags", schema_builder_set_flags, 1);
248
+ rb_define_method(cCSchemaBuilder, "set_nullable", schema_builder_set_nullable, 1);
249
+ rb_define_method(cCSchemaBuilder, "validate", schema_builder_validate, 0);
250
+ rb_define_method(cCSchemaBuilder, "finish", schema_builder_finish, 0);
251
+ }