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

Method CalculateHeaderSize

cpp/src/arrow/csv/writer.cc:600–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598 }
599
600 int64_t CalculateHeaderSize(QuotingStyle quoting_style) const {
601 int64_t header_length = 0;
602 for (int col = 0; col < schema_->num_fields(); col++) {
603 const std::string& col_name = schema_->field(col)->name();
604 header_length += col_name.size();
605 switch (quoting_style) {
606 case QuotingStyle::None:
607 break;
608 case QuotingStyle::Needed:
609 case QuotingStyle::AllValid:
610 header_length += CountQuotes(col_name);
611 break;
612 }
613 }
614 header_length += kDelimiterCount * (schema_->num_fields() - 1) + options_.eol.size();
615 switch (quoting_style) {
616 case QuotingStyle::None:
617 break;
618 case QuotingStyle::Needed:
619 case QuotingStyle::AllValid:
620 header_length += kQuoteCount * schema_->num_fields();
621 break;
622 }
623 return header_length;
624 }
625
626 Status WriteHeader() {
627 // Only called once, as part of initialization

Callers

nothing calls this directly

Calls 5

CountQuotesFunction · 0.85
num_fieldsMethod · 0.45
nameMethod · 0.45
fieldMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected