| 186 | end |
| 187 | |
| 188 | def create_builder(builder_info) |
| 189 | builder_type = builder_info[:builder_type] |
| 190 | case builder_type |
| 191 | when :decimal128 |
| 192 | data_type = Decimal128DataType.new(builder_info[:precision], |
| 193 | builder_info[:scale]) |
| 194 | Decimal128ArrayBuilder.new(data_type) |
| 195 | when :decimal256 |
| 196 | data_type = Decimal256DataType.new(builder_info[:precision], |
| 197 | builder_info[:scale]) |
| 198 | Decimal256ArrayBuilder.new(data_type) |
| 199 | when :int |
| 200 | min = builder_info[:min] |
| 201 | max = builder_info[:max] |
| 202 | |
| 203 | if GLib::MININT8 <= min && max <= GLib::MAXINT8 |
| 204 | Int8ArrayBuilder.new |
| 205 | elsif GLib::MININT16 <= min && max <= GLib::MAXINT16 |
| 206 | Int16ArrayBuilder.new |
| 207 | elsif GLib::MININT32 <= min && max <= GLib::MAXINT32 |
| 208 | Int32ArrayBuilder.new |
| 209 | elsif GLib::MININT64 <= min && max <= GLib::MAXINT64 |
| 210 | Int64ArrayBuilder.new |
| 211 | else |
| 212 | StringArrayBuilder.new |
| 213 | end |
| 214 | when :uint |
| 215 | max = builder_info[:max] |
| 216 | |
| 217 | if max <= GLib::MAXUINT8 |
| 218 | UInt8ArrayBuilder.new |
| 219 | elsif max <= GLib::MAXUINT16 |
| 220 | UInt16ArrayBuilder.new |
| 221 | elsif max <= GLib::MAXUINT32 |
| 222 | UInt32ArrayBuilder.new |
| 223 | elsif max <= GLib::MAXUINT64 |
| 224 | UInt64ArrayBuilder.new |
| 225 | else |
| 226 | StringArrayBuilder.new |
| 227 | end |
| 228 | else |
| 229 | nil |
| 230 | end |
| 231 | end |
| 232 | end |
| 233 | |
| 234 | def build(values) |