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

Simple predicate evaluation conumes 38 instructions per row with codegen enabled

    Details

      Description

      Consider inlining ExecNode::EvalConjuncts to avoid function call followed by virtual function call to ExprContext::GetBooleanVal.

      According to Vtune 24 cycles and 38 instructions are spent per row for the comparison.

      https://github.com/cloudera/Impala/blob/cdh5-trunk/be/src/exec/hdfs-parquet-scanner.cc#L1972

          if (has_conjuncts && !ExecNode::EvalConjuncts(
              conjunct_ctxs, num_conjuncts, reinterpret_cast<TupleRow*>(output_row))) {
            continue;
          }
      

      Followed by

      bool ExecNode::EvalConjuncts(ExprContext* const* ctxs, int num_ctxs, TupleRow* row) {
        for (int i = 0; i < num_ctxs; ++i) {
          BooleanVal v = ctxs[i]->GetBooleanVal(row);
          if (v.is_null || !v.val) return false;
        }
        return true;
      }
      

      Query used

      select count(*) from lineitem where l_orderkey  = 1;
      

      From vtune

      Heading 1 Heading 2
      Col A1 Col A2
      Function Stack Clockticks: Total
      impala::HdfsParquetScanner::ProcessSplit 69.90%
      -impala::HdfsParquetScanner::AssembleRows 67.00%
      --impala::HdfsParquetScanner::TransferScratchTuples 32.50%
      — impala::ExecNode::EvalConjuncts 25.20%
      ---- impala::ExprContext::GetBooleanVal 12.30%
      ------ impala::ScalarFnCall::GetBooleanVal 5.90%
      impalad ! impala::ScalarFnCall::GetBooleanVal - scalar-fn-call.cc
      impalad ! impala::ExprContext::GetBooleanVal + 0x16 - expr-context.cc:342
      impalad ! impala::ExecNode::EvalConjuncts + 0x39 - exec-node.cc:442
      impalad ! impala::HdfsParquetScanner::TransferScratchTuples + 0x203 - hdfs-parquet-scanner.cc:1973
      impalad ! impala::HdfsParquetScanner::AssembleRows + 0x244 - hdfs-parquet-scanner.cc:2087
      impalad ! impala::HdfsParquetScanner::ProcessSplit + 0x4e9 - hdfs-parquet-scanner.cc:1893
      impalad ! impala::HdfsScanNode::ProcessSplit + 0x3a5 - hdfs-scan-node.cc:1198
      impalad ! impala::HdfsScanNode::ScannerThread + 0xcad - hdfs-scan-node.cc:1076
      impalad ! impala::Thread::SuperviseThread + 0x226 - thread.cc:315
      impalad ! boost::detail::thread_data<boost::_bi::bind_t<void, void (*)(std::string const&, std::string const&, boost::function<void (void)>, impala::Promise<long>*), boost::_bi::list4<boost::_bi::value<std::string>, boost::_bi::value<std::string>, boost::_bi::value<boost::function<void (void)>>, boost::_bi::value<impala::Promise<long>*>>>>::run + 0x73 - thread.hpp:116
      impalad ! thread_proxy + 0xd9 - [unknown source file]
      libpthread-2.12.so ! start_thread + 0xd0 - [unknown source file]
      libc-2.12.so ! clone + 0x6c - [unknown source file]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                twmarshall Thomas Tauber-Marshall
                Reporter:
                mmokhtar Mostafa Mokhtar
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: