MCPcopy Create free account
hub / github.com/apache/arrow / ParsePartitionSegments

Method ParsePartitionSegments

cpp/src/arrow/dataset/partition.cc:341–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339}
340
341Result<std::vector<KeyValuePartitioning::Key>>
342KeyValuePartitioning::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
370DirectoryPartitioning::DirectoryPartitioning(std::shared_ptr<Schema> schema,
371 ArrayVector dictionaries,

Callers

nothing calls this directly

Calls 7

push_backMethod · 0.80
ValidateUTF8Function · 0.50
InvalidFunction · 0.50
NotImplementedFunction · 0.50
num_fieldsMethod · 0.45
nameMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected