Skip to content

Commit

Permalink
Rename Instance to InstanceKey (rerun-io#1002)
Browse files Browse the repository at this point in the history
* Rename Instance to InstanceKey

* rerun.instance -> rerun.instance_key

* Selection::Instance -> Selection::InstancePath

* instance_index -> instance_key

* "For instance" -> "For example"

* `instance` -> `instance_key`

* Update the once missed table
  • Loading branch information
emilk authored Jan 31, 2023
1 parent 822dd23 commit fe4b4b8
Show file tree
Hide file tree
Showing 59 changed files with 640 additions and 618 deletions.
12 changes: 6 additions & 6 deletions crates/re_arrow_store/benches/data_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use criterion::{criterion_group, criterion_main, Criterion};

use re_arrow_store::{DataStore, LatestAtQuery, RangeQuery, TimeInt, TimeRange};
use re_log_types::{
component_types::{Instance, Rect2D},
component_types::{InstanceKey, Rect2D},
datagen::{build_frame_nr, build_some_instances, build_some_rects},
msg_bundle::{try_build_msg_bundle2, Component as _, MsgBundle},
ComponentName, EntityPath, MsgId, TimeType, Timeline,
Expand Down Expand Up @@ -35,15 +35,15 @@ fn insert(c: &mut Criterion) {
(NUM_RECTS * NUM_FRAMES) as _,
));
group.bench_function("insert", |b| {
b.iter(|| insert_messages(Instance::name(), msgs.iter()));
b.iter(|| insert_messages(InstanceKey::name(), msgs.iter()));
});
}
}

fn latest_at_batch(c: &mut Criterion) {
{
let msgs = build_messages(NUM_RECTS as usize);
let store = insert_messages(Instance::name(), msgs.iter());
let store = insert_messages(InstanceKey::name(), msgs.iter());
let mut group = c.benchmark_group("datastore/latest_at/batch/rects");
group.throughput(criterion::Throughput::Elements(NUM_RECTS as _));
group.bench_function("query", |b| {
Expand All @@ -64,7 +64,7 @@ fn latest_at_batch(c: &mut Criterion) {
fn latest_at_missing_components(c: &mut Criterion) {
{
let msgs = build_messages(NUM_RECTS as usize);
let store = insert_messages(Instance::name(), msgs.iter());
let store = insert_messages(InstanceKey::name(), msgs.iter());
let mut group = c.benchmark_group("datastore/latest_at/missing_components");
group.throughput(criterion::Throughput::Elements(NUM_RECTS as _));
group.bench_function("primary", |b| {
Expand All @@ -78,7 +78,7 @@ fn latest_at_missing_components(c: &mut Criterion) {

{
let msgs = build_messages(NUM_RECTS as usize);
let store = insert_messages(Instance::name(), msgs.iter());
let store = insert_messages(InstanceKey::name(), msgs.iter());
let mut group = c.benchmark_group("datastore/latest_at/missing_components");
group.throughput(criterion::Throughput::Elements(NUM_RECTS as _));
group.bench_function("secondaries", |b| {
Expand All @@ -103,7 +103,7 @@ fn latest_at_missing_components(c: &mut Criterion) {
fn range_batch(c: &mut Criterion) {
{
let msgs = build_messages(NUM_RECTS as usize);
let store = insert_messages(Instance::name(), msgs.iter());
let store = insert_messages(InstanceKey::name(), msgs.iter());
let mut group = c.benchmark_group("datastore/range/batch/rects");
group.throughput(criterion::Throughput::Elements(
(NUM_RECTS * NUM_FRAMES) as _,
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/dump_dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use re_arrow_store::{test_bundle, DataStore};
use re_log_types::{
component_types::Instance,
component_types::InstanceKey,
datagen::{
build_frame_nr, build_log_time, build_some_instances, build_some_instances_from,
build_some_point2d, build_some_rects,
Expand All @@ -18,7 +18,7 @@ use re_log_types::{
// ---

fn main() {
let mut store = DataStore::new(Instance::name(), Default::default());
let mut store = DataStore::new(InstanceKey::name(), Default::default());

let ent_paths = [
EntityPath::from("this/that"),
Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/latest_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use re_arrow_store::{test_bundle, DataStore, LatestAtQuery, TimeType, Timeline};
use re_log_types::component_types::Rect2D;
use re_log_types::datagen::build_some_rects;
use re_log_types::{
component_types::{Instance, Point2D},
component_types::{InstanceKey, Point2D},
datagen::{build_frame_nr, build_some_point2d},
msg_bundle::Component,
EntityPath,
};

fn main() {
let mut store = DataStore::new(Instance::name(), Default::default());
let mut store = DataStore::new(InstanceKey::name(), Default::default());

let ent_path = EntityPath::from("my/entity");

Expand Down
4 changes: 2 additions & 2 deletions crates/re_arrow_store/examples/latest_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use polars_core::prelude::*;
use re_arrow_store::polars_util::latest_components;
use re_arrow_store::{test_bundle, DataStore, LatestAtQuery, TimeType, Timeline};
use re_log_types::{
component_types::{Instance, Point2D, Rect2D},
component_types::{InstanceKey, Point2D, Rect2D},
datagen::{build_frame_nr, build_some_point2d, build_some_rects},
msg_bundle::Component,
EntityPath,
};

fn main() {
let mut store = DataStore::new(Instance::name(), Default::default());
let mut store = DataStore::new(InstanceKey::name(), Default::default());

let ent_path = EntityPath::from("my/entity");

Expand Down
8 changes: 4 additions & 4 deletions crates/re_arrow_store/examples/range_components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
use polars_core::prelude::JoinType;
use re_arrow_store::{polars_util, test_bundle, DataStore, RangeQuery, TimeRange};
use re_log_types::{
component_types::{Instance, Point2D, Rect2D},
component_types::{InstanceKey, Point2D, Rect2D},
datagen::{build_frame_nr, build_some_point2d, build_some_rects},
msg_bundle::Component as _,
EntityPath, TimeType, Timeline,
};

fn main() {
let mut store = DataStore::new(Instance::name(), Default::default());
let mut store = DataStore::new(InstanceKey::name(), Default::default());

let ent_path = EntityPath::from("this/that");

Expand Down Expand Up @@ -56,7 +56,7 @@ fn main() {
&query,
&ent_path,
Rect2D::name(),
[Instance::name(), Rect2D::name(), Point2D::name()],
[InstanceKey::name(), Rect2D::name(), Point2D::name()],
&JoinType::Outer,
);
for (time, df) in dfs.map(Result::unwrap) {
Expand All @@ -78,7 +78,7 @@ fn main() {
&query,
&ent_path,
Point2D::name(),
[Instance::name(), Rect2D::name(), Point2D::name()],
[InstanceKey::name(), Rect2D::name(), Point2D::name()],
&JoinType::Outer,
);
for (time, df) in dfs.map(Result::unwrap) {
Expand Down
80 changes: 40 additions & 40 deletions crates/re_arrow_store/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,37 +645,37 @@ impl PersistentIndexTable {
/// size: 64 B across 2 rows
/// - log_time: from 19:37:35.713798Z to 19:37:35.713798Z (all inclusive)
/// data (sorted=true):
/// +-------------------------------+--------------+---------------+----------------+
/// | log_time | rerun.rect2d | rerun.point2d | rerun.instance |
/// +-------------------------------+--------------+---------------+----------------+
/// | 2022-12-20 19:37:35.713798552 | | 2 | 2 |
/// | 2022-12-20 19:37:35.713798552 | 4 | | 2 |
/// +-------------------------------+--------------+---------------+----------------+
/// +-------------------------------+--------------+---------------+--------------------+
/// | log_time | rerun.rect2d | rerun.point2d | rerun.instance_key |
/// +-------------------------------+--------------+---------------+--------------------+
/// | 2022-12-20 19:37:35.713798552 | | 2 | 2 |
/// | 2022-12-20 19:37:35.713798552 | 4 | | 2 |
/// +-------------------------------+--------------+---------------+--------------------+
///
/// }
/// IndexBucket {
/// index time bound: >= 19:37:36.713798Z
/// size: 64 B across 2 rows
/// - log_time: from 19:37:36.713798Z to 19:37:36.713798Z (all inclusive)
/// data (sorted=true):
/// +-------------------------------+--------------+----------------+---------------+
/// | log_time | rerun.rect2d | rerun.instance | rerun.point2d |
/// +-------------------------------+--------------+----------------+---------------+
/// | 2022-12-20 19:37:36.713798552 | 1 | 2 | |
/// | 2022-12-20 19:37:36.713798552 | | 4 | |
/// +-------------------------------+--------------+----------------+---------------+
/// +-------------------------------+--------------+--------------------+---------------+
/// | log_time | rerun.rect2d | rerun.instance_key | rerun.point2d |
/// +-------------------------------+--------------+--------------------+---------------+
/// | 2022-12-20 19:37:36.713798552 | 1 | 2 | |
/// | 2022-12-20 19:37:36.713798552 | | 4 | |
/// +-------------------------------+--------------+--------------------+---------------+
///
/// }
/// IndexBucket {
/// index time bound: >= 19:37:37.713798Z
/// size: 24 B across 1 rows
/// - log_time: from 19:37:37.713798Z to 19:37:37.713798Z (all inclusive)
/// data (sorted=true):
/// +-------------------------------+--------------+----------------+
/// | log_time | rerun.rect2d | rerun.instance |
/// +-------------------------------+--------------+----------------+
/// | 2022-12-20 19:37:37.713798552 | 2 | 3 |
/// +-------------------------------+--------------+----------------+
/// +-------------------------------+--------------+--------------------+
/// | log_time | rerun.rect2d | rerun.instance_key |
/// +-------------------------------+--------------+--------------------+
/// | 2022-12-20 19:37:37.713798552 | 2 | 3 |
/// +-------------------------------+--------------+--------------------+
///
/// }
/// ]
Expand All @@ -694,40 +694,40 @@ impl PersistentIndexTable {
/// size: 96 B across 3 rows
/// - frame_nr: from #41 to #41 (all inclusive)
/// data (sorted=true):
/// +----------+---------------+--------------+----------------+
/// | frame_nr | rerun.point2d | rerun.rect2d | rerun.instance |
/// +----------+---------------+--------------+----------------+
/// | 41 | | | 1 |
/// | 41 | 1 | | 2 |
/// | 41 | | 3 | 2 |
/// +----------+---------------+--------------+----------------+
/// +----------+---------------+--------------+--------------------+
/// | frame_nr | rerun.point2d | rerun.rect2d | rerun.instance_key |
/// +----------+---------------+--------------+--------------------+
/// | 41 | | | 1 |
/// | 41 | 1 | | 2 |
/// | 41 | | 3 | 2 |
/// +----------+---------------+--------------+--------------------+
///
/// }
/// IndexBucket {
/// index time bound: >= #42
/// size: 96 B across 3 rows
/// - frame_nr: from #42 to #42 (all inclusive)
/// data (sorted=true):
/// +----------+--------------+----------------+---------------+
/// | frame_nr | rerun.rect2d | rerun.instance | rerun.point2d |
/// +----------+--------------+----------------+---------------+
/// | 42 | 1 | 2 | |
/// | 42 | | 4 | |
/// | 42 | | 2 | 2 |
/// +----------+--------------+----------------+---------------+
/// +----------+--------------+--------------------+---------------+
/// | frame_nr | rerun.rect2d | rerun.instance_key | rerun.point2d |
/// +----------+--------------+--------------------+---------------+
/// | 42 | 1 | 2 | |
/// | 42 | | 4 | |
/// | 42 | | 2 | 2 |
/// +----------+--------------+--------------------+---------------+
///
/// }
/// IndexBucket {
/// index time bound: >= #43
/// size: 64 B across 2 rows
/// - frame_nr: from #43 to #44 (all inclusive)
/// data (sorted=true):
/// +----------+--------------+---------------+----------------+
/// | frame_nr | rerun.rect2d | rerun.point2d | rerun.instance |
/// +----------+--------------+---------------+----------------+
/// | 43 | 4 | | 2 |
/// | 44 | | 3 | 2 |
/// +----------+--------------+---------------+----------------+
/// +----------+--------------+---------------+--------------------+
/// | frame_nr | rerun.rect2d | rerun.point2d | rerun.instance_key |
/// +----------+--------------+---------------+--------------------+
/// | 43 | 4 | | 2 |
/// | 44 | | 3 | 2 |
/// +----------+--------------+---------------+--------------------+
///
/// }
/// ]
Expand Down Expand Up @@ -1125,7 +1125,7 @@ impl PersistentComponentTable {
/// Example of a component table holding instances:
/// ```text
/// ComponentTable {
/// name: rerun.instance
/// name: rerun.instance_key
/// size: 2 buckets for a total of 128 B across 5 total rows
/// buckets: [
/// ComponentBucket {
Expand All @@ -1135,7 +1135,7 @@ impl PersistentComponentTable {
/// time ranges:
/// - frame_nr: from #41 to #41 (all inclusive)
/// +------------------------------------------------------------------+
/// | rerun.instance |
/// | rerun.instance_key |
/// +------------------------------------------------------------------+
/// | [] |
/// | [2382325256275464629, 9801782006807296871, 13644487945655724411] |
Expand All @@ -1150,7 +1150,7 @@ impl PersistentComponentTable {
/// - frame_nr: from #42 to #42 (all inclusive)
/// - log_time: from 19:37:36.713798Z to 19:37:37.713798Z (all inclusive)
/// +-------------------------------------------------------------------+
/// | rerun.instance |
/// | rerun.instance_key |
/// +-------------------------------------------------------------------+
/// | [8907162807054976021, 14953141369327162382, 15742885776230395882] |
/// | [165204472818569687, 3210188998985913268, 13675065411448304501] |
Expand Down
40 changes: 20 additions & 20 deletions crates/re_arrow_store/src/store_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,40 +736,40 @@ impl IndexBucket {
/// size: 96 B across 3 rows
/// - frame_nr: from #41 to #41 (all inclusive)
/// data (sorted=true):
/// +----------+---------------+--------------+----------------+
/// | frame_nr | rerun.point2d | rerun.rect2d | rerun.instance |
/// +----------+---------------+--------------+----------------+
/// | 41 | | | 1 |
/// | 41 | 1 | | 2 |
/// | 41 | | 3 | 2 |
/// +----------+---------------+--------------+----------------+
/// +----------+---------------+--------------+--------------------+
/// | frame_nr | rerun.point2d | rerun.rect2d | rerun.instance_key |
/// +----------+---------------+--------------+--------------------+
/// | 41 | | | 1 |
/// | 41 | 1 | | 2 |
/// | 41 | | 3 | 2 |
/// +----------+---------------+--------------+--------------------+
///
/// }
/// IndexBucket {
/// index time bound: >= #42
/// size: 96 B across 3 rows
/// - frame_nr: from #42 to #42 (all inclusive)
/// data (sorted=true):
/// +----------+--------------+----------------+---------------+
/// | frame_nr | rerun.rect2d | rerun.instance | rerun.point2d |
/// +----------+--------------+----------------+---------------+
/// | 42 | 1 | 2 | |
/// | 42 | | 4 | |
/// | 42 | | 2 | 2 |
/// +----------+--------------+----------------+---------------+
/// +----------+--------------+--------------------+--------------------+
/// | frame_nr | rerun.rect2d | rerun.instance_key | rerun.point2d |
/// +----------+--------------+--------------------+-------------------+
/// | 42 | 1 | 2 | |
/// | 42 | | 4 | |
/// | 42 | | 2 | 2 |
/// +----------+--------------+--------------------+-------------------+
///
/// }
/// IndexBucket {
/// index time bound: >= #43
/// size: 64 B across 2 rows
/// - frame_nr: from #43 to #44 (all inclusive)
/// data (sorted=true):
/// +----------+--------------+---------------+----------------+
/// | frame_nr | rerun.rect2d | rerun.point2d | rerun.instance |
/// +----------+--------------+---------------+----------------+
/// | 43 | 4 | | 2 |
/// | 44 | | 3 | 2 |
/// +----------+--------------+---------------+----------------+
/// +----------+--------------+---------------+--------------------+
/// | frame_nr | rerun.rect2d | rerun.point2d | rerun.instance_key |
/// +----------+--------------+---------------+--------------------+
/// | 43 | 4 | | 2 |
/// | 44 | | 3 | 2 |
/// +----------+--------------+---------------+--------------------+
///
/// }
/// ]
Expand Down
Loading

0 comments on commit fe4b4b8

Please sign in to comment.