Skip to content

Expand rust APIs to support new Data API concepts #7495

@jleibs

Description

@jleibs

The rust APIs need to facilitate implementing: #7455

There are three main concepts missing:

  • A more powerful content expression
  • A configurable sampling mechanism
  • Making the LatestAt resolution optional

I believe we can actually drop LatestAtQueryExpression, and just have a single QueryExpression that builds on top of the previous RangeQuery.

The minimal change is to QueryExpression is something like:

struct ViewContents{
    contents: BTreeMap<EntityPathExpr: BTreeSet<ComponentName>>,
}

// TODO: builder because crazy runtime interactions between filters etc
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct QueryExpression {
    /// The contents that populate the view for the query.
    ///
    /// Example: `world/camera/**`
    pub view_contents: ViewContents,

    /// The timeline to query.
    ///
    /// Example `frame`
    pub timeline: Timeline,

    /// The time range to query.
    pub filtered_index_range: ResolvedTimeRange,

    pub filtered_index_values: Option<Vec<TimeInt>>,

    pub filtered_events_for: Option<ComponentColumnSelector>,

    // Sample times
    pub sampled_index_values: Option<Vec<TimeInt>>,
 
    /// Resolve latest-at
    pub resolve_latest_at: bool,
} 

Possible post-0.19 improvements:

Alternatively, we could put resolve_latest_at on the ComponentColumnSelector which would be more powerful.

/// Select a component based on its `EntityPath` and `ComponentName`.
///
/// Note, that in the future when Rerun supports duplicate tagged components
/// on the same entity, this selector may be ambiguous. In this case, the
/// query result will return an Error if it cannot determine a single selected
/// component.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct ComponentColumnSelector {
    /// The path of the entity.
    pub entity_path: EntityPath,

    /// Semantic name associated with this data.
    pub component: ComponentName,

    /// Resolve latest-at
    pub resolve_latest_at: bool,

    /// How to join the data into the `RecordBatch`.
    pub join_encoding: JoinEncoding,
}

The additional work related to Views / Contents can be abstracted by python.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions