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

Method Validate

cpp/src/arrow/util/tdigest.cc:110–122  ·  view source on GitHub ↗

validate k-size of a tdigest

Source from the content-addressed store, hash-verified

108
109 // validate k-size of a tdigest
110 Status Validate(const std::vector<Centroid>& tdigest, double total_weight) const {
111 double q_prev = 0, k_prev = this->K(0);
112 for (size_t i = 0; i < tdigest.size(); ++i) {
113 const double q = q_prev + tdigest[i].weight / total_weight;
114 const double k = this->K(q);
115 if (tdigest[i].weight != 1 && (k - k_prev) > 1.001) {
116 return Status::Invalid("oversized centroid: ", k - k_prev);
117 }
118 k_prev = k;
119 q_prev = q;
120 }
121 return Status::OK();
122 }
123
124 private:
125 double total_weight_; // total weight of this tdigest

Callers

nothing calls this directly

Calls 4

InvalidFunction · 0.50
OKFunction · 0.50
KMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected