| 96 | } |
| 97 | |
| 98 | extern "C" void Init_arrow() { |
| 99 | auto mArrow = rb_const_get_at(rb_cObject, rb_intern("Arrow")); |
| 100 | |
| 101 | auto cArrowArray = rb_const_get_at(mArrow, rb_intern("Array")); |
| 102 | rb_define_method(cArrowArray, "values", |
| 103 | reinterpret_cast<rb::RawMethod>(red_arrow::array_values), |
| 104 | 0); |
| 105 | |
| 106 | auto cArrowChunkedArray = rb_const_get_at(mArrow, rb_intern("ChunkedArray")); |
| 107 | rb_define_method(cArrowChunkedArray, "values", |
| 108 | reinterpret_cast<rb::RawMethod>(red_arrow::chunked_array_values), |
| 109 | 0); |
| 110 | |
| 111 | auto cArrowRecordBatch = rb_const_get_at(mArrow, rb_intern("RecordBatch")); |
| 112 | rb_define_method(cArrowRecordBatch, "raw_records", |
| 113 | reinterpret_cast<rb::RawMethod>(red_arrow::record_batch_raw_records), |
| 114 | 0); |
| 115 | rb_define_method(cArrowRecordBatch, "each_raw_record", |
| 116 | reinterpret_cast<rb::RawMethod>(red_arrow::record_batch_each_raw_record), |
| 117 | 0); |
| 118 | |
| 119 | auto cArrowTable = rb_const_get_at(mArrow, rb_intern("Table")); |
| 120 | rb_define_method(cArrowTable, "raw_records", |
| 121 | reinterpret_cast<rb::RawMethod>(red_arrow::table_raw_records), |
| 122 | 0); |
| 123 | rb_define_method(cArrowTable, "each_raw_record", |
| 124 | reinterpret_cast<rb::RawMethod>(red_arrow::table_each_raw_record), |
| 125 | 0); |
| 126 | |
| 127 | red_arrow::cDate = rb_const_get(rb_cObject, rb_intern("Date")); |
| 128 | |
| 129 | red_arrow::cArrowTime = rb_const_get_at(mArrow, rb_intern("Time")); |
| 130 | |
| 131 | auto cArrowTimeUnit = rb_const_get_at(mArrow, rb_intern("TimeUnit")); |
| 132 | red_arrow::ArrowTimeUnitSECOND = |
| 133 | rb_const_get_at(cArrowTimeUnit, rb_intern("SECOND")); |
| 134 | red_arrow::ArrowTimeUnitMILLI = |
| 135 | rb_const_get_at(cArrowTimeUnit, rb_intern("MILLI")); |
| 136 | red_arrow::ArrowTimeUnitMICRO = |
| 137 | rb_const_get_at(cArrowTimeUnit, rb_intern("MICRO")); |
| 138 | red_arrow::ArrowTimeUnitNANO = |
| 139 | rb_const_get_at(cArrowTimeUnit, rb_intern("NANO")); |
| 140 | |
| 141 | red_arrow::id_BigDecimal = rb_intern("BigDecimal"); |
| 142 | red_arrow::id_jd = rb_intern("jd"); |
| 143 | red_arrow::id_new = rb_intern("new"); |
| 144 | red_arrow::id_to_datetime = rb_intern("to_datetime"); |
| 145 | |
| 146 | red_arrow::memory_view::init(mArrow); |
| 147 | |
| 148 | red_arrow::symbols::day = ID2SYM(rb_intern("day")); |
| 149 | red_arrow::symbols::millisecond = ID2SYM(rb_intern("millisecond")); |
| 150 | red_arrow::symbols::month = ID2SYM(rb_intern("month")); |
| 151 | red_arrow::symbols::nanosecond = ID2SYM(rb_intern("nanosecond")); |
| 152 | |
| 153 | rbgobj_register_mark_func(GARROW_TYPE_RECORD_BATCH_READER, |
| 154 | red_arrow::record_batch_reader_mark); |
| 155 | rbgobj_register_mark_func(GARROW_TYPE_EXECUTE_PLAN, |