Exemple #1
0
void DeleteTranslator::Consume(ConsumerContext &, RowBatch::Row &row) const {
  CodeGen &codegen = GetCodeGen();

  // Call Deleter::Delete(tile_group_id, tuple_offset)
  auto *deleter = LoadStatePtr(deleter_state_id_);
  codegen.Call(DeleterProxy::Delete,
               {deleter, row.GetTileGroupID(), row.GetTID(codegen)});
}
Value NegationTranslator::DeriveValue(CodeGen &codegen,
                                      RowBatch::Row &row) const {
  const auto &negation_expr =
      GetExpressionAs<expression::OperatorUnaryMinusExpression>();
  Value child_value = row.DeriveValue(codegen, *negation_expr.GetChild(0));
  return child_value.CallUnaryOp(codegen, OperatorId::Negation);
}
// Produce the value that is the result of codegening the expression
codegen::Value ConjunctionTranslator::DeriveValue(CodeGen &codegen,
                                                  RowBatch::Row &row) const {
  const auto &conjunction =
      GetExpressionAs<expression::ConjunctionExpression>();
  codegen::Value left = row.DeriveValue(codegen, *conjunction.GetChild(0));
  codegen::Value right = row.DeriveValue(codegen, *conjunction.GetChild(1));

  switch (conjunction.GetExpressionType()) {
    case ExpressionType::CONJUNCTION_AND:
      return left.LogicalAnd(codegen, right);
    case ExpressionType::CONJUNCTION_OR:
      return left.LogicalOr(codegen, right);
    default:
      throw Exception{"Received a non-conjunction expression type: " +
                      ExpressionTypeToString(conjunction.GetExpressionType())};
  }
}
Exemple #4
0
// Pass this row to the next operator in the pipeline
void ConsumerContext::Consume(RowBatch::Row &row) {
  // If we're at a stage boundary in the pipeline, it means the next operator
  // in the pipeline wants to operate on a batch of rows. To facilitate this,
  // we mark the given row as valid in this batch and return immediately.
  if (pipeline_.AtStageBoundary()) {
    auto &codegen = GetCodeGen();
    row.SetValidity(codegen, codegen.ConstBool(true));
    return;
  }

  // Otherwise, we move along to the next operator in the pipeline and deliver
  // the row there.
  auto *translator = pipeline_.NextStep();
  if (translator != nullptr) {
    translator->Consume(*this, row);
    return;
  }

  // We're at the end of the query pipeline, we now send the output tuples
  // to the result consumer configured in the compilation context
  auto &consumer = compilation_context_.GetExecutionConsumer();
  consumer.ConsumeResult(*this, row);
}
codegen::Value TableScanTranslator::AttributeAccess::Access(
    CodeGen &codegen, RowBatch::Row &row) {
  auto raw_row = tile_group_access_.GetRow(row.GetTID(codegen));
  return raw_row.LoadColumn(codegen, ai_->attribute_id);
}
Exemple #6
0
void RowBatch::OutputTracker::AppendRowToOutput(CodeGen &codegen,
                                                RowBatch::Row &row,
                                                llvm::Value *delta) {
  output_.SetValue(codegen, target_pos_, row.GetTID(codegen));
  final_pos_ = codegen->CreateAdd(target_pos_, delta);
}