MCPcopy Create free account
hub / github.com/apache/impala / CompareBasedOnSize

Method CompareBasedOnSize

be/src/util/tuple-row-compare.cc:384–407  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382
383template<typename U>
384int TupleRowZOrderComparator::CompareBasedOnSize(const TupleRow* lhs,
385 const TupleRow* rhs) const {
386 auto less_msb = [](U x, U y) { return x < y && x < (x ^ y); };
387 ColumnType type = ordering_exprs_[num_lexical_keys_]->type();
388 // Values of the most significant dimension from both sides.
389 U msd_lhs = GetSharedRepresentation<U>(
390 ordering_expr_evals_lhs_[num_lexical_keys_]->GetValue(lhs), type);
391 U msd_rhs = GetSharedRepresentation<U>(
392 ordering_expr_evals_rhs_[num_lexical_keys_]->GetValue(rhs), type);
393 for (int i = num_lexical_keys_ + 1; i < ordering_exprs_.size(); ++i) {
394 type = ordering_exprs_[i]->type();
395 void* lhs_v = ordering_expr_evals_lhs_[i]->GetValue(lhs);
396 void* rhs_v = ordering_expr_evals_rhs_[i]->GetValue(rhs);
397
398 U lhsi = GetSharedRepresentation<U>(lhs_v, type);
399 U rhsi = GetSharedRepresentation<U>(rhs_v, type);
400
401 if (less_msb(msd_lhs ^ msd_rhs, lhsi ^ rhsi)) {
402 msd_lhs = lhsi;
403 msd_rhs = rhsi;
404 }
405 }
406 return msd_lhs < msd_rhs ? -1 : (msd_lhs > msd_rhs ? 1 : 0);
407}
408
409template <typename U>
410U TupleRowZOrderComparator::GetSharedRepresentation(void* val, ColumnType type) const {

Callers

nothing calls this directly

Calls 3

typeMethod · 0.45
GetValueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected