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