Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
Impala 2.7.0
Description
The IR generated for the TopN node is pretty suboptimal. We codegen the outer Insert loop, and we codegen the comparator function, but we don't convert the indirect call to a function pointer comparator into a direct inlinable function call. The below C++ code is just cross-compile wholesale without removing the branch or function pointer, and also bringing in a huge amount of unnecessary IR for the interpreted Compare() path.
bool ALWAYS_INLINE Less(const TupleRow* lhs, const TupleRow* rhs) const { int result = codegend_compare_fn_ == NULL ? Compare(lhs, rhs) : (*codegend_compare_fn_)(&key_expr_ctxs_lhs_[0], &key_expr_ctxs_rhs_[0], lhs, rhs); if (result < 0) return true; return false; }
Attachments
Issue Links
- blocks
-
IMPALA-4065 Inline comparator calls into TopN::InsertBatch()
- Resolved