@since 0.12.0
(*values)
| 238 | |
| 239 | # @since 0.12.0 |
| 240 | def append(*values) |
| 241 | value_convertable = respond_to?(:convert_to_arrow_value, true) |
| 242 | start_index = 0 |
| 243 | current_index = 0 |
| 244 | status = :value |
| 245 | |
| 246 | values.each do |value| |
| 247 | if value.nil? |
| 248 | if status == :value |
| 249 | if start_index != current_index |
| 250 | target_values = values[start_index...current_index] |
| 251 | if value_convertable |
| 252 | target_values = target_values.collect do |v| |
| 253 | convert_to_arrow_value(v) |
| 254 | end |
| 255 | end |
| 256 | append_values(target_values, nil) |
| 257 | start_index = current_index |
| 258 | end |
| 259 | status = :null |
| 260 | end |
| 261 | else |
| 262 | if status == :null |
| 263 | append_nulls(current_index - start_index) |
| 264 | start_index = current_index |
| 265 | status = :value |
| 266 | end |
| 267 | end |
| 268 | current_index += 1 |
| 269 | end |
| 270 | if start_index != current_index |
| 271 | if status == :value |
| 272 | if start_index == 0 and current_index == values.size |
| 273 | target_values = values |
| 274 | else |
| 275 | target_values = values[start_index...current_index] |
| 276 | end |
| 277 | if value_convertable |
| 278 | target_values = target_values.collect do |v| |
| 279 | convert_to_arrow_value(v) |
| 280 | end |
| 281 | end |
| 282 | append_values(target_values, nil) |
| 283 | else |
| 284 | append_nulls(current_index - start_index) |
| 285 | end |
| 286 | end |
| 287 | end |
| 288 | end |
| 289 | end |