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

Method CompareInterpreted

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

Source from the content-addressed store, hash-verified

89}
90
91int TupleRowLexicalComparator::CompareInterpreted(
92 const TupleRow* lhs, const TupleRow* rhs) const {
93 DCHECK_EQ(ordering_exprs_.size(), ordering_expr_evals_lhs_.size());
94 DCHECK_EQ(ordering_expr_evals_lhs_.size(), ordering_expr_evals_rhs_.size());
95 for (int i = 0; i < ordering_expr_evals_lhs_.size(); ++i) {
96 void* lhs_value = ordering_expr_evals_lhs_[i]->GetValue(lhs);
97 void* rhs_value = ordering_expr_evals_rhs_[i]->GetValue(rhs);
98
99 // The sort order of NULLs is independent of asc/desc.
100 if (lhs_value == NULL && rhs_value == NULL) continue;
101 if (lhs_value == NULL && rhs_value != NULL) return nulls_first_[i];
102 if (lhs_value != NULL && rhs_value == NULL) return -nulls_first_[i];
103
104 int result = RawValue::Compare(lhs_value, rhs_value, ordering_exprs_[i]->type());
105 if (!is_asc_[i]) result = -result;
106 if (result != 0) return result;
107 // Otherwise, try the next Expr
108 }
109 return 0; // fully equivalent key
110}
111
112// Codegens an unrolled version of TupleRowLexicalComparator::Compare(). Uses codegen'd
113// key exprs and injects nulls_first_ and is_asc_ values.

Callers

nothing calls this directly

Calls 3

sizeMethod · 0.45
GetValueMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected