| 1227 | } |
| 1228 | |
| 1229 | std::shared_ptr<Converter> Converter::Make( |
| 1230 | const std::shared_ptr<ChunkedArray>& chunked_array) { |
| 1231 | const auto& type = chunked_array->type(); |
| 1232 | switch (type->id()) { |
| 1233 | // direct support |
| 1234 | case Type::INT32: |
| 1235 | return std::make_shared<arrow::r::Converter_Int<arrow::Int32Type>>(chunked_array); |
| 1236 | |
| 1237 | case Type::DOUBLE: |
| 1238 | return std::make_shared<arrow::r::Converter_Double<arrow::DoubleType>>( |
| 1239 | chunked_array); |
| 1240 | |
| 1241 | // need to handle 1-bit case |
| 1242 | case Type::BOOL: |
| 1243 | return std::make_shared<arrow::r::Converter_Boolean>(chunked_array); |
| 1244 | |
| 1245 | case Type::BINARY: |
| 1246 | return std::make_shared<arrow::r::Converter_Binary<arrow::BinaryArray>>( |
| 1247 | chunked_array); |
| 1248 | |
| 1249 | case Type::LARGE_BINARY: |
| 1250 | return std::make_shared<arrow::r::Converter_Binary<arrow::LargeBinaryArray>>( |
| 1251 | chunked_array); |
| 1252 | |
| 1253 | case Type::FIXED_SIZE_BINARY: |
| 1254 | return std::make_shared<arrow::r::Converter_FixedSizeBinary>( |
| 1255 | chunked_array, checked_cast<const FixedSizeBinaryType&>(*type).byte_width()); |
| 1256 | |
| 1257 | // handle memory dense strings |
| 1258 | case Type::STRING: |
| 1259 | return std::make_shared<arrow::r::Converter_String<arrow::StringArray>>( |
| 1260 | chunked_array); |
| 1261 | |
| 1262 | case Type::LARGE_STRING: |
| 1263 | return std::make_shared<arrow::r::Converter_String<arrow::LargeStringArray>>( |
| 1264 | chunked_array); |
| 1265 | |
| 1266 | case Type::DICTIONARY: |
| 1267 | return std::make_shared<arrow::r::Converter_Dictionary>(chunked_array); |
| 1268 | |
| 1269 | case Type::DATE32: |
| 1270 | return std::make_shared<arrow::r::Converter_Date32>(chunked_array); |
| 1271 | |
| 1272 | case Type::DATE64: |
| 1273 | return std::make_shared<arrow::r::Converter_Date64>(chunked_array); |
| 1274 | |
| 1275 | // promotions to integer vector |
| 1276 | case Type::INT8: |
| 1277 | return std::make_shared<arrow::r::Converter_Int<arrow::Int8Type>>(chunked_array); |
| 1278 | |
| 1279 | case Type::UINT8: |
| 1280 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt8Type>>(chunked_array); |
| 1281 | |
| 1282 | case Type::INT16: |
| 1283 | return std::make_shared<arrow::r::Converter_Int<arrow::Int16Type>>(chunked_array); |
| 1284 | |
| 1285 | case Type::UINT16: |
| 1286 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt16Type>>(chunked_array); |
nothing calls this directly
no test coverage detected