| 339 | } |
| 340 | |
| 341 | Result<std::vector<KeyValuePartitioning::Key>> |
| 342 | KeyValuePartitioning::ParsePartitionSegments( |
| 343 | const std::vector<std::string>& segments) const { |
| 344 | int i = 0; |
| 345 | std::vector<Key> keys; |
| 346 | for (auto&& segment : segments) { |
| 347 | if (i >= schema_->num_fields()) break; |
| 348 | |
| 349 | switch (options_.segment_encoding) { |
| 350 | case SegmentEncoding::None: { |
| 351 | if (ARROW_PREDICT_FALSE(!util::ValidateUTF8(segment))) { |
| 352 | return Status::Invalid("Partition segment was not valid UTF-8: ", segment); |
| 353 | } |
| 354 | keys.push_back({schema_->field(i++)->name(), std::move(segment)}); |
| 355 | break; |
| 356 | } |
| 357 | case SegmentEncoding::Uri: { |
| 358 | ARROW_ASSIGN_OR_RAISE(auto decoded, SafeUriUnescape(segment)); |
| 359 | keys.push_back({schema_->field(i++)->name(), std::move(decoded)}); |
| 360 | break; |
| 361 | } |
| 362 | default: |
| 363 | return Status::NotImplemented("Unknown segment encoding: ", |
| 364 | options_.segment_encoding); |
| 365 | } |
| 366 | } |
| 367 | return keys; |
| 368 | } |
| 369 | |
| 370 | DirectoryPartitioning::DirectoryPartitioning(std::shared_ptr<Schema> schema, |
| 371 | ArrayVector dictionaries, |
nothing calls this directly
no test coverage detected