Turi Create  4.0
turi::query_eval::query_context Class Reference

#include <core/storage/query_engine/execution/query_context.hpp>

Public Member Functions

std::shared_ptr< const sframe_rowsget_next (size_t input_number)
 
void skip_next (size_t input_number)
 
std::shared_ptr< sframe_rowsget_output_buffer ()
 
void emit (const std::shared_ptr< sframe_rows > &rows)
 
bool should_skip ()
 
size_t block_size () const
 

Detailed Description

This is the object passed to the coroutine which allows the coroutine to read and write values. The expected usage pattern of the coroutine is:

void fn(query_context& ctx) {
while(1) {
auto input = ctx.get_next(0); // from 1st input. get_next(1) for 2nd input, etc.
auto output = get_output_buffer();
// fill output buffer. Its just an sframe_rows
ctx.emit(output); // only if output is non-empty.
}
}

Definition at line 37 of file query_context.hpp.

Member Function Documentation

◆ block_size()

size_t turi::query_eval::query_context::block_size ( ) const
inline

The commmunication block size.

Definition at line 78 of file query_context.hpp.

◆ emit()

void turi::query_eval::query_context::emit ( const std::shared_ptr< sframe_rows > &  rows)

Emits a collection of rows. The number of rows emitted MUST be the same as block_size(), except for the very last block of rows. Should yield immediately after emitting a block.

◆ get_next()

std::shared_ptr<const sframe_rows> turi::query_eval::query_context::get_next ( size_t  input_number)

Requests for the next block for the given input.

◆ get_output_buffer()

std::shared_ptr<sframe_rows> turi::query_eval::query_context::get_output_buffer ( )

Returns a pointer to an output buffer.

◆ should_skip()

bool turi::query_eval::query_context::should_skip ( )

Returns true if the operator should try to skip a block.

◆ skip_next()

void turi::query_eval::query_context::skip_next ( size_t  input_number)

Requests for the next block for the given input to the skipped.


The documentation for this class was generated from the following file: