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

Method FormatPartitionSegments

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

Source from the content-addressed store, hash-verified

316}
317
318Result<std::vector<std::string>> KeyValuePartitioning::FormatPartitionSegments(
319 const ScalarVector& values) const {
320 std::vector<std::string> segments(static_cast<size_t>(schema_->num_fields()));
321
322 for (int i = 0; i < schema_->num_fields(); ++i) {
323 if (values[i] != nullptr && values[i]->is_valid) {
324 segments[i] = values[i]->ToString();
325 continue;
326 }
327
328 if (auto illegal_index = NextValid(values, i)) {
329 // XXX maybe we should just ignore keys provided after the first absent one?
330 return Status::Invalid("No partition key for ", schema_->field(i)->name(),
331 " but a key was provided subsequently for ",
332 schema_->field(*illegal_index)->name(), ".");
333 }
334
335 // if all subsequent keys are absent we'll just print the available keys
336 break;
337 }
338 return segments;
339}
340
341Result<std::vector<KeyValuePartitioning::Key>>
342KeyValuePartitioning::ParsePartitionSegments(

Callers

nothing calls this directly

Calls 6

NextValidFunction · 0.85
InvalidFunction · 0.50
num_fieldsMethod · 0.45
ToStringMethod · 0.45
nameMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected