Пример #1
0
  inline void execute(query_context& context) {
    size_t i = 0;
    while(i < m_len) {
      auto ret = context.get_output_buffer();
      size_t len = std::min(m_len - i, context.block_size());

      ret->resize(1, len);
      for (auto& value: *(ret->get_columns()[0])) value = m_value;
      context.emit(ret);
      i += len;
    }
  }
Пример #2
0
    inline void execute(query_context& context) {
        if (!m_reader) m_reader = m_source->get_reader();
        auto start = m_begin_index;
        auto block_size = context.block_size();
        bool skip_next_block = false;
        emit_state state = context.initial_state();

        while (start != m_end_index) {
            auto rows = context.get_output_buffer();
            auto end = std::min(start + block_size, m_end_index);
            if (skip_next_block == false) {
                m_reader->read_rows(start, end, *rows);
                state = context.emit(rows);
            } else {
                state = context.emit(nullptr);
            }
            skip_next_block = state == emit_state::SKIP_NEXT_BLOCK;
            start = end;
        }
    }