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