| 1402 | } |
| 1403 | |
| 1404 | bool vector_from_r_memory(SEXP x, const std::shared_ptr<DataType>& type, |
| 1405 | std::vector<std::shared_ptr<arrow::ChunkedArray>>& columns, |
| 1406 | int j, RTasks& tasks) { |
| 1407 | if (ALTREP(x)) return false; |
| 1408 | |
| 1409 | switch (type->id()) { |
| 1410 | case Type::INT32: |
| 1411 | return TYPEOF(x) == INTSXP && !Rf_isObject(x) && |
| 1412 | vector_from_r_memory_impl<cpp11::integers, Int32Type>(x, type, columns, j, |
| 1413 | tasks); |
| 1414 | |
| 1415 | case Type::DOUBLE: |
| 1416 | return TYPEOF(x) == REALSXP && !Rf_isObject(x) && |
| 1417 | vector_from_r_memory_impl<cpp11::doubles, DoubleType>(x, type, columns, j, |
| 1418 | tasks); |
| 1419 | |
| 1420 | case Type::UINT8: |
| 1421 | return TYPEOF(x) == RAWSXP && !Rf_isObject(x) && |
| 1422 | vector_from_r_memory_impl<cpp11::raws, UInt8Type>(x, type, columns, j, |
| 1423 | tasks); |
| 1424 | |
| 1425 | case Type::INT64: |
| 1426 | return TYPEOF(x) == REALSXP && Rf_inherits(x, "integer64") && |
| 1427 | vector_from_r_memory_impl<cpp11::doubles, Int64Type>(x, type, columns, j, |
| 1428 | tasks); |
| 1429 | default: |
| 1430 | break; |
| 1431 | } |
| 1432 | |
| 1433 | return false; |
| 1434 | } |
| 1435 | |
| 1436 | } // namespace r |
| 1437 | } // namespace arrow |