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; } }
inline void execute(query_context& context) { std::vector<std::shared_ptr<const sframe_rows> > input_v(num_inputs); std::vector< std::vector< std::shared_ptr< std::vector<graphlab::flexible_type> > > > input_columns(num_inputs); while(1) { bool all_null = true, any_null = false; for(size_t i = 0; i < num_inputs; ++i) { input_v[i] = context.get_next(i); if(input_v[i] == nullptr) any_null = true; else all_null = false; } if(any_null) { ASSERT_TRUE(all_null); break; } for(size_t i = 0; i < num_inputs; ++i) { input_columns[i] = std::move(input_v[i]->get_columns()); } auto out = context.get_output_buffer(); auto& out_columns = out->get_columns(); out_columns.clear(); for(const std::pair<size_t, size_t>& p : index_map) { out_columns.push_back(input_columns[p.first][p.second]); } context.emit(out); } }