Пример #1
0
void subplan_executor::generate_to_callback_function(
    const std::shared_ptr<planner_node>& plan,
    size_t output_segment_id,
    execution_callback out_function) {

  std::map<std::shared_ptr<planner_node>, std::shared_ptr<execution_node> > memo;
  std::shared_ptr<execution_node> ex_op = get_executor(plan, memo);

  size_t consumer_id = ex_op->register_consumer();

  while(1) {
    auto rows = ex_op->get_next(consumer_id);
    if (rows == nullptr)
      break;

    bool done = out_function(output_segment_id, rows);
    if(done)
      break;
  }
  
  // look through the list of all nodes for exceptions
  bool has_exception = false;
  for(auto& nodes: memo) {
    if (nodes.second->exception_occurred()) {
      has_exception = true;
    }
  }
      // find the earliest exception which occured.
  if (has_exception) {
    std::set<std::shared_ptr<execution_node>> memo;
    auto earliest_exception = find_earliest_exception(ex_op, memo);
    std::rethrow_exception(earliest_exception);
  }
}
Пример #2
0
static std::shared_ptr<execution_node> get_executor(
    const std::shared_ptr<planner_node>& p,
    std::map<std::shared_ptr<planner_node>, 
             std::shared_ptr<execution_node> >& memo) {
  // See if things are cached; if so, just return that.
  if(memo.count(p)) return memo[p];

  // First, get all the inputs
  std::vector<std::shared_ptr<execution_node> > inputs(p->inputs.size());

  for(size_t i = 0; i < p->inputs.size(); ++i) {
    inputs[i] = get_executor(p->inputs[i], memo);
  }
  // Make the operator.
  std::shared_ptr<query_operator> op = planner_node_to_operator(p);
  memo[p] = std::make_shared<execution_node>(op, inputs);
  return memo[p]; 
}
Пример #3
0
    ip::udp::socket socket7(std::move(socket6));
#endif // defined(ASIO_HAS_MOVE)

    // basic_datagram_socket operators.

#if defined(ASIO_HAS_MOVE)
    socket1 = ip::udp::socket(ioc);
    socket1 = std::move(socket2);
#endif // defined(ASIO_HAS_MOVE)

    // basic_io_object functions.

    io_context& ioc_ref = socket1.get_io_context();
    (void)ioc_ref;

    ip::udp::socket::executor_type ex = socket1.get_executor();
    (void)ex;

    // basic_socket functions.

    ip::udp::socket::lowest_layer_type& lowest_layer = socket1.lowest_layer();
    (void)lowest_layer;

    const ip::udp::socket& socket8 = socket1;
    const ip::udp::socket::lowest_layer_type& lowest_layer2
      = socket8.lowest_layer();
    (void)lowest_layer2;

    socket1.open(ip::udp::v4());
    socket1.open(ip::udp::v6());
    socket1.open(ip::udp::v4(), ec);