Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-3815

Clean up TopN node codegen'd code

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • Impala 2.7.0
    • Impala 2.8.0
    • Backend

    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

          Activity

            People

              tarmstrong Tim Armstrong
              tarmstrong Tim Armstrong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: