| 205 | } |
| 206 | |
| 207 | std::pair<std::vector<void*>, std::vector<std::vector<cudf::bitmask_type>>> init( |
| 208 | size_t total_rows, const std::vector<int> &column_indices, |
| 209 | const std::vector<cudf::type_id> &cudf_types) |
| 210 | { |
| 211 | cudf::io::table_with_metadata ret; |
| 212 | std::vector<void*> host_cols(column_indices.size()); |
| 213 | auto const num_words = cudf::bitmask_allocation_size_bytes(total_rows)/sizeof(cudf::bitmask_type); |
| 214 | auto null_masks = std::vector<std::vector<cudf::bitmask_type>>(host_cols.size()); |
| 215 | |
| 216 | for (int col = 0; col < host_cols.size(); ++col) { |
| 217 | null_masks[col].resize(num_words, 0); |
| 218 | size_t projection = column_indices[col]; |
| 219 | cudf::type_id cudf_type_id = cudf_types[projection]; |
| 220 | switch (cudf_type_id) { |
| 221 | case cudf::type_id::EMPTY: {} break; |
| 222 | case cudf::type_id::INT8: { |
| 223 | std::vector<int8_t> *tmp = new std::vector<int8_t>(); |
| 224 | tmp->resize(total_rows); |
| 225 | host_cols[col] = tmp; |
| 226 | } break; |
| 227 | case cudf::type_id::INT16: { |
| 228 | std::vector<int16_t> *tmp = new std::vector<int16_t>(); |
| 229 | tmp->resize(total_rows); |
| 230 | host_cols[col] = tmp; |
| 231 | } break; |
| 232 | case cudf::type_id::INT32: { |
| 233 | std::vector<int32_t> *tmp = new std::vector<int32_t>(); |
| 234 | tmp->resize(total_rows); |
| 235 | host_cols[col] = tmp; |
| 236 | } break; |
| 237 | case cudf::type_id::INT64: { |
| 238 | std::vector<int64_t> *tmp = new std::vector<int64_t>(); |
| 239 | tmp->resize(total_rows); |
| 240 | host_cols[col] = tmp; |
| 241 | } break; |
| 242 | case cudf::type_id::UINT8: { |
| 243 | std::vector<uint8_t> *tmp = new std::vector<uint8_t>(); |
| 244 | tmp->resize(total_rows); |
| 245 | host_cols[col] = tmp; |
| 246 | } break; |
| 247 | case cudf::type_id::UINT16: { |
| 248 | std::vector<uint16_t> *tmp = new std::vector<uint16_t>(); |
| 249 | tmp->resize(total_rows); |
| 250 | host_cols[col] = tmp; |
| 251 | } break; |
| 252 | case cudf::type_id::UINT32: { |
| 253 | std::vector<uint32_t> *tmp = new std::vector<uint32_t>(); |
| 254 | tmp->resize(total_rows); |
| 255 | host_cols[col] = tmp; |
| 256 | } break; |
| 257 | case cudf::type_id::UINT64: { |
| 258 | std::vector<uint64_t> *tmp = new std::vector<uint64_t>(); |
| 259 | tmp->resize(total_rows); |
| 260 | host_cols[col] = tmp; |
| 261 | } break; |
| 262 | case cudf::type_id::FLOAT32: { |
| 263 | std::vector<float> *tmp = new std::vector<float>(); |
| 264 | tmp->resize(total_rows); |