pub struct ApiaryQueryContext { /* private fields */ }Expand description
The Apiary query context — wraps DataFusion with Apiary namespace resolution.
Implementations§
Source§impl ApiaryQueryContext
impl ApiaryQueryContext
Sourcepub fn new(
storage: Arc<dyn StorageBackend>,
registry: Arc<RegistryManager>,
) -> ApiaryQueryContext
pub fn new( storage: Arc<dyn StorageBackend>, registry: Arc<RegistryManager>, ) -> ApiaryQueryContext
Create a new query context.
Sourcepub fn with_node_id(
storage: Arc<dyn StorageBackend>,
registry: Arc<RegistryManager>,
node_id: NodeId,
) -> ApiaryQueryContext
pub fn with_node_id( storage: Arc<dyn StorageBackend>, registry: Arc<RegistryManager>, node_id: NodeId, ) -> ApiaryQueryContext
Create a new query context with a specific node ID.
Sourcepub async fn sql(
&mut self,
query: &str,
) -> Result<Vec<RecordBatch>, ApiaryError>
pub async fn sql( &mut self, query: &str, ) -> Result<Vec<RecordBatch>, ApiaryError>
Execute a SQL query and return results as RecordBatches.
Sourcepub async fn execute_distributed(
&self,
sql: &str,
assignments: HashMap<NodeId, Vec<CellInfo>>,
) -> Result<Vec<RecordBatch>, ApiaryError>
pub async fn execute_distributed( &self, sql: &str, assignments: HashMap<NodeId, Vec<CellInfo>>, ) -> Result<Vec<RecordBatch>, ApiaryError>
Execute a query using distributed execution (stub for Step 7).
For v1, this is a simplified implementation that:
- Creates tasks from cell assignments
- Generates SQL fragments (simple pass-through)
- Writes the query manifest
- Executes local tasks
- Polls for partial results from other nodes
- Merges results (simple concatenation)
- Cleans up query files
Sourcepub async fn execute_task(
&self,
sql: &str,
cell_keys: &[String],
) -> Result<Vec<RecordBatch>, ApiaryError>
pub async fn execute_task( &self, sql: &str, cell_keys: &[String], ) -> Result<Vec<RecordBatch>, ApiaryError>
Execute a task on a specific set of cells.
§Arguments
sql- The SQL query to executecell_keys- Storage keys of cells to scan. Only these cells are registered as the table for the query, enabling true work partitioning across nodes.
Auto Trait Implementations§
impl Freeze for ApiaryQueryContext
impl !RefUnwindSafe for ApiaryQueryContext
impl Send for ApiaryQueryContext
impl Sync for ApiaryQueryContext
impl Unpin for ApiaryQueryContext
impl UnsafeUnpin for ApiaryQueryContext
impl !UnwindSafe for ApiaryQueryContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more