| 1333 | } |
| 1334 | |
| 1335 | std::shared_ptr<Converter> Converter::Make( |
| 1336 | const std::shared_ptr<ChunkedArray>& chunked_array) { |
| 1337 | const auto& type = chunked_array->type(); |
| 1338 | switch (type->id()) { |
| 1339 | // direct support |
| 1340 | case Type::INT32: |
| 1341 | return std::make_shared<arrow::r::Converter_Int<arrow::Int32Type>>(chunked_array); |
| 1342 | |
| 1343 | case Type::DOUBLE: |
| 1344 | return std::make_shared<arrow::r::Converter_Double<arrow::DoubleType>>( |
| 1345 | chunked_array); |
| 1346 | |
| 1347 | // need to handle 1-bit case |
| 1348 | case Type::BOOL: |
| 1349 | return std::make_shared<arrow::r::Converter_Boolean>(chunked_array); |
| 1350 | |
| 1351 | case Type::BINARY: |
| 1352 | return std::make_shared<arrow::r::Converter_Binary<arrow::BinaryArray>>( |
| 1353 | chunked_array); |
| 1354 | |
| 1355 | case Type::LARGE_BINARY: |
| 1356 | return std::make_shared<arrow::r::Converter_Binary<arrow::LargeBinaryArray>>( |
| 1357 | chunked_array); |
| 1358 | |
| 1359 | case Type::FIXED_SIZE_BINARY: |
| 1360 | return std::make_shared<arrow::r::Converter_FixedSizeBinary>( |
| 1361 | chunked_array, checked_cast<const FixedSizeBinaryType&>(*type).byte_width()); |
| 1362 | |
| 1363 | // handle memory dense strings |
| 1364 | case Type::STRING: |
| 1365 | return std::make_shared<arrow::r::Converter_String<arrow::StringArray>>( |
| 1366 | chunked_array); |
| 1367 | |
| 1368 | case Type::LARGE_STRING: |
| 1369 | return std::make_shared<arrow::r::Converter_String<arrow::LargeStringArray>>( |
| 1370 | chunked_array); |
| 1371 | |
| 1372 | case Type::DICTIONARY: |
| 1373 | return std::make_shared<arrow::r::Converter_Dictionary>(chunked_array); |
| 1374 | |
| 1375 | case Type::DATE32: |
| 1376 | return std::make_shared<arrow::r::Converter_Date32>(chunked_array); |
| 1377 | |
| 1378 | case Type::DATE64: |
| 1379 | return std::make_shared<arrow::r::Converter_Date64>(chunked_array); |
| 1380 | |
| 1381 | // promotions to integer vector |
| 1382 | case Type::INT8: |
| 1383 | return std::make_shared<arrow::r::Converter_Int<arrow::Int8Type>>(chunked_array); |
| 1384 | |
| 1385 | case Type::UINT8: |
| 1386 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt8Type>>(chunked_array); |
| 1387 | |
| 1388 | case Type::INT16: |
| 1389 | return std::make_shared<arrow::r::Converter_Int<arrow::Int16Type>>(chunked_array); |
| 1390 | |
| 1391 | case Type::UINT16: |
| 1392 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt16Type>>(chunked_array); |
nothing calls this directly
no test coverage detected