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

Codegen CopyRows() for select nodes

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Impala 2.8.0
    • Fix Version/s: Impala 2.11.0
    • Component/s: Backend
    • Labels:

      Description

      We should codegen CopyRows(() in Select node. We can already codegen EvalConjuncts() and inline it into a codegen'd version of CopyRows. One can look at how scanners codegen their conjuncts as examples.

      bool SelectNode::CopyRows(RowBatch* output_batch) {
        ExprContext** conjunct_ctxs = &conjunct_ctxs_[0];
        int num_conjunct_ctxs = conjunct_ctxs_.size();
      
        while (child_row_idx_ < child_row_batch_->num_rows()) {
          // Add a new row to output_batch
          int dst_row_idx = output_batch->AddRow();
          TupleRow* dst_row = output_batch->GetRow(dst_row_idx);
          TupleRow* src_row = child_row_batch_->GetRow(child_row_idx_);
          // Make sure to increment row idx before returning.
          ++child_row_idx_;
      
          if (EvalConjuncts(conjunct_ctxs, num_conjunct_ctxs, src_row)) { <<----
            output_batch->CopyRow(src_row, dst_row);
            output_batch->CommitLastRow();
            ++num_rows_returned_;
            COUNTER_SET(rows_returned_counter_, num_rows_returned_);
            if (ReachedLimit() || output_batch->AtCapacity()) return true;
          }
        }
        return output_batch->AtCapacity();
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bikramjeet.vig Bikramjeet Vig
                Reporter:
                kwho Michael Ho
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: