| 1205 | } |
| 1206 | |
| 1207 | std::shared_ptr<Converter> Converter::Make( |
| 1208 | const std::shared_ptr<ChunkedArray>& chunked_array) { |
| 1209 | const auto& type = chunked_array->type(); |
| 1210 | switch (type->id()) { |
| 1211 | // direct support |
| 1212 | case Type::INT32: |
| 1213 | return std::make_shared<arrow::r::Converter_Int<arrow::Int32Type>>(chunked_array); |
| 1214 | |
| 1215 | case Type::DOUBLE: |
| 1216 | return std::make_shared<arrow::r::Converter_Double<arrow::DoubleType>>( |
| 1217 | chunked_array); |
| 1218 | |
| 1219 | // need to handle 1-bit case |
| 1220 | case Type::BOOL: |
| 1221 | return std::make_shared<arrow::r::Converter_Boolean>(chunked_array); |
| 1222 | |
| 1223 | case Type::BINARY: |
| 1224 | return std::make_shared<arrow::r::Converter_Binary<arrow::BinaryArray>>( |
| 1225 | chunked_array); |
| 1226 | |
| 1227 | case Type::LARGE_BINARY: |
| 1228 | return std::make_shared<arrow::r::Converter_Binary<arrow::LargeBinaryArray>>( |
| 1229 | chunked_array); |
| 1230 | |
| 1231 | case Type::FIXED_SIZE_BINARY: |
| 1232 | return std::make_shared<arrow::r::Converter_FixedSizeBinary>( |
| 1233 | chunked_array, checked_cast<const FixedSizeBinaryType&>(*type).byte_width()); |
| 1234 | |
| 1235 | // handle memory dense strings |
| 1236 | case Type::STRING: |
| 1237 | return std::make_shared<arrow::r::Converter_String<arrow::StringArray>>( |
| 1238 | chunked_array); |
| 1239 | |
| 1240 | case Type::LARGE_STRING: |
| 1241 | return std::make_shared<arrow::r::Converter_String<arrow::LargeStringArray>>( |
| 1242 | chunked_array); |
| 1243 | |
| 1244 | case Type::DICTIONARY: |
| 1245 | return std::make_shared<arrow::r::Converter_Dictionary>(chunked_array); |
| 1246 | |
| 1247 | case Type::DATE32: |
| 1248 | return std::make_shared<arrow::r::Converter_Date32>(chunked_array); |
| 1249 | |
| 1250 | case Type::DATE64: |
| 1251 | return std::make_shared<arrow::r::Converter_Date64>(chunked_array); |
| 1252 | |
| 1253 | // promotions to integer vector |
| 1254 | case Type::INT8: |
| 1255 | return std::make_shared<arrow::r::Converter_Int<arrow::Int8Type>>(chunked_array); |
| 1256 | |
| 1257 | case Type::UINT8: |
| 1258 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt8Type>>(chunked_array); |
| 1259 | |
| 1260 | case Type::INT16: |
| 1261 | return std::make_shared<arrow::r::Converter_Int<arrow::Int16Type>>(chunked_array); |
| 1262 | |
| 1263 | case Type::UINT16: |
| 1264 | return std::make_shared<arrow::r::Converter_Int<arrow::UInt16Type>>(chunked_array); |
nothing calls this directly
no test coverage detected