Skip to content

Deprecate SeriesLine/SeriesPoint/Scalar in favor of SeriesLines/SeriesPoints/Scalars #9338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 61 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7d8d352
replace panic with proper error messages for some codegen paths
Wumpf Mar 20, 2025
1355efe
fix handling arrays of enums in codegen
Wumpf Mar 20, 2025
7a51c37
add pluralized versions of series line/points & scalar, deprecating s…
Wumpf Mar 20, 2025
c413849
remove experimental multi scalar demo, we have other demos & tests to…
Wumpf Mar 20, 2025
c2c3bd4
Update examples etc ...
Wumpf Mar 20, 2025
467d2c7
add test to ensure that deprecated points & lines types work
Wumpf Mar 20, 2025
11fd99f
rust doc fix
Wumpf Mar 21, 2025
e2c09b9
python doc gen fix
Wumpf Mar 21, 2025
db046de
add migration guide
Wumpf Mar 21, 2025
36816b8
more rust doc fix
Wumpf Mar 21, 2025
3c40b69
add back deprecated types to gen_common_index.py
Wumpf Mar 21, 2025
6affb7c
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 25, 2025
e6075d5
fix typos
emilk Mar 25, 2025
3f60ebb
Improve error message from `rerun rrd verify` command
emilk Mar 25, 2025
06e1374
Migrate renamed archetypes and field names
emilk Mar 25, 2025
04f240a
Remove explicit code to handle deprecated archetypes
emilk Mar 25, 2025
3cdf51d
Convert `#[allow(deprecated)]` to `#[expect(deprecated)]`
emilk Mar 25, 2025
10954ad
Exclude deprecated types from snippets INDEX.md
emilk Mar 25, 2025
06f2a5e
Revert changes to old migration guide
emilk Mar 25, 2025
9ec2e80
Comment on when the types were deprecated
emilk Mar 25, 2025
c3cb8c7
Remove unnecessary test
emilk Mar 25, 2025
97339a3
Reorder some code
emilk Mar 25, 2025
e92afbe
Add back `visible_series` field for less breaking change
emilk Mar 25, 2025
0d3beec
Add convenience constructor `Scalars::one`
emilk Mar 25, 2025
0f49949
Mark all @classmethods as deprecated if the class is
emilk Mar 26, 2025
2762c4d
Remove unused snapshot images
emilk Mar 26, 2025
550cd34
Fix order of `@classmethod` and `@deprecated`
emilk Mar 26, 2025
3d2d40b
Raise exceptions when calling deprecated functions
emilk Mar 26, 2025
69153a6
Raise exceptions when calling deprecated functions
emilk Mar 26, 2025
ec36e42
Be strict when building examples
emilk Mar 26, 2025
00edd61
Update examples to not use deprecated parameter
emilk Mar 26, 2025
696dd35
Update examples from `Scalar` to `Scalars`
emilk Mar 26, 2025
6a40f2d
`SeriesLine` -> `SeriesLines`
emilk Mar 26, 2025
ba5c483
SeriesPoint -> SeriesPoints
emilk Mar 26, 2025
9008f69
Revert "Raise exceptions when calling deprecated functions"
emilk Mar 26, 2025
64beb8f
Pluralize parameter names
emilk Mar 26, 2025
c283b81
2nd attempt
grtlr Mar 26, 2025
824f844
py-fmt
emilk Mar 26, 2025
55ec6bf
Merge branch 'grtlr/fix-graphs-color' into emilk/raise-on-warning
emilk Mar 26, 2025
8a7d721
Merge branch 'emilk/raise-on-warning' into andreas/pluralize-series-t…
emilk Mar 26, 2025
2c41a6f
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 26, 2025
8b2268c
Make it an error to link to a deprecated object
emilk Mar 26, 2025
763e7a0
Update doclinks to new objects
emilk Mar 26, 2025
df6ea45
rr.Scalar -> rr.Scalars
emilk Mar 26, 2025
80e0f63
rr.SeriesLine -> rr.SeriesLines
emilk Mar 26, 2025
3ea415b
Try to make it an error to use deprecated functions in C++… but failing
emilk Mar 26, 2025
a0634b8
More converting of old names into new
emilk Mar 26, 2025
c65fb86
Fix double word
emilk Mar 26, 2025
881695f
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 26, 2025
a5e912b
compare_snippet_output.py: print all failures, not just the first one
emilk Mar 26, 2025
d93778f
Use proper colors in C++ snippets
emilk Mar 26, 2025
0046eec
plural
emilk Mar 26, 2025
526f55e
Fix `docs/snippets/all/archetypes/scalars_multiple_plots.cpp`
emilk Mar 26, 2025
92972cc
codegen
emilk Mar 26, 2025
3dc5b60
Mark new archetypes as unreleased
emilk Mar 26, 2025
5242857
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 26, 2025
4be1e0d
Opt-out of compare due to floating point differences
emilk Mar 27, 2025
312f3fe
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 27, 2025
14bddd5
Remove old reference from snippet
emilk Mar 27, 2025
c54f726
fix opt-out
emilk Mar 27, 2025
ae59cdf
Merge branch 'main' into andreas/pluralize-series-types
emilk Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ API usage examples:

for step in range(0, 64):
rr.set_time_sequence("step", step)
rr.log("scalar", rr.Scalar(math.sin(step / 10.0)))
rr.log("scalar", rr.Scalars(math.sin(step / 10.0)))
```

Using `send()` (fast, memory efficient):
Expand Down Expand Up @@ -779,7 +779,7 @@ API usage examples:

for step in 0..64 {
rec.set_time_sequence("step", step);
rec.log("scalar", &rerun::Scalar::new((step as f64 / 10.0).sin()))?;
rec.log("scalar", &rerun::Scalars::new((step as f64 / 10.0).sin()))?;
}
```

Expand Down
7 changes: 0 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2421,13 +2421,6 @@ dependencies = [
"pin-project-lite",
]

[[package]]
name = "experimental_multi_scalar"
version = "0.23.0-alpha.1+dev"
dependencies = [
"rerun",
]

[[package]]
name = "extend_viewer_ui"
version = "0.23.0-alpha.1+dev"
Expand Down
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ members = [
"examples/rust/*",
"rerun_py",
"run_wasm",
"tests/rust/experimental_multi_scalar",
"tests/rust/log_benchmark",
"tests/rust/plot_dashboard_stress",
"tests/rust/roundtrips/*",
Expand Down
2 changes: 1 addition & 1 deletion crates/store/re_chunk_store/src/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ pub struct QueryExpression {
/// ```text
/// view_contents = {
/// "world/points": [rr.Position3D, rr.Radius],
/// "metrics": [rr.Scalar]
/// "metrics": [rr.Scalars]
/// }
/// ```
pub view_contents: Option<ViewContentsSelector>,
Expand Down
2 changes: 2 additions & 0 deletions crates/store/re_sorbet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ mod error;
mod index_column_descriptor;
mod ipc;
mod metadata;
mod migration;
mod row_id_column_descriptor;
mod sorbet_batch;
mod sorbet_columns;
Expand All @@ -44,6 +45,7 @@ pub use self::{
ArrowBatchMetadata, ArrowFieldMetadata, MetadataExt, MissingFieldMetadata,
MissingMetadataKey,
},
migration::migrate_record_batch,
row_id_column_descriptor::{RowIdColumnDescriptor, WrongDatatypeError},
sorbet_batch::SorbetBatch,
sorbet_columns::SorbetColumnDescriptors,
Expand Down
93 changes: 93 additions & 0 deletions crates/store/re_sorbet/src/migration.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
//! Handles migrating old `re_types` to new ones.
//!
//!
use std::collections::BTreeMap;

use arrow::{
array::{ArrayRef as ArrowArrayRef, RecordBatch as ArrowRecordBatch, RecordBatchOptions},
datatypes::{Field as ArrowField, FieldRef as ArrowFieldRef, Schema as ArrowSchema},
};

/// Migrate old renamed types to new types.
pub fn migrate_record_batch(batch: &ArrowRecordBatch) -> ArrowRecordBatch {
re_tracing::profile_function!();

struct ArchetypeRename {
new_name: &'static str,
field_renames: BTreeMap<&'static str, &'static str>,
}

let archetype_renames = BTreeMap::from([
(
"rerun.archetypes.Scalar",
ArchetypeRename {
new_name: "rerun.archetypes.Scalars",
field_renames: [("scalar", "scalars")].into(),
},
),
(
"rerun.archetypes.SeriesLine",
ArchetypeRename {
new_name: "rerun.archetypes.SeriesLines",
field_renames: [("color", "colors"), ("width", "widths"), ("name", "names")].into(),
},
),
(
"rerun.archetypes.SeriesPoint",
ArchetypeRename {
new_name: "rerun.archetypes.SeriesPoints",
field_renames: [
("color", "colors"),
("marker", "markers"),
("name", "names"),
("marker_size", "marker_sizes"),
]
.into(),
},
),
]);

let num_columns = batch.num_columns();
let mut fields: Vec<ArrowFieldRef> = Vec::with_capacity(num_columns);
let mut columns: Vec<ArrowArrayRef> = Vec::with_capacity(num_columns);

for (field, array) in itertools::izip!(batch.schema().fields(), batch.columns()) {
let mut metadata = field.metadata().clone();
if let Some(archetype) = metadata.get_mut("rerun.archetype") {
if let Some(archetype_rename) = archetype_renames.get(archetype.as_str()) {
re_log::debug_once!(
"Migrating {archetype:?} to {:?}…",
archetype_rename.new_name
);

// Rename archetype:
*archetype = archetype_rename.new_name.to_owned();

// Renmame fields:
if let Some(archetype_field) = metadata.get_mut("rerun.archetype_field") {
if let Some(new_field_name) =
archetype_rename.field_renames.get(archetype_field.as_str())
{
*archetype_field = (*new_field_name).to_owned();
}
}
}
}

let field = ArrowField::clone(field.as_ref())
.clone()
.with_metadata(metadata);

fields.push(field.into());
columns.push(array.clone());
}

let schema = ArrowSchema::new_with_metadata(fields, batch.schema().metadata.clone());

ArrowRecordBatch::try_new_with_options(
schema.into(),
columns,
&RecordBatchOptions::default().with_row_count(Some(batch.num_rows())),
)
.expect("Can't fail")
}
3 changes: 3 additions & 0 deletions crates/store/re_sorbet/src/sorbet_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,16 @@ impl From<&SorbetBatch> for ArrowRecordBatch {

impl SorbetBatch {
/// Will automatically wrap data columns in `ListArrays` if they are not already.
///
/// Will also migrate old types to new types.
pub fn try_from_record_batch(
batch: &ArrowRecordBatch,
batch_type: crate::BatchType,
) -> Result<Self, SorbetError> {
re_tracing::profile_function!();

let batch = make_all_data_columns_list_arrays(batch);
let batch = crate::migrate_record_batch(&batch);

let sorbet_schema = SorbetSchema::try_from(batch.schema_ref().as_ref())?;

Expand Down
3 changes: 3 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 7 additions & 8 deletions crates/store/re_types/definitions/rerun/archetypes/scalar.fbs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
namespace rerun.archetypes;

// ---

/// A double-precision scalar, e.g. for use for time-series plots.
///
/// The current timeline value will be used for the time/X-axis, hence scalars
/// cannot be static.
/// should not be static.
///
/// When used to produce a plot, this archetype is used to provide the data that
/// is referenced by [archetypes.SeriesLine] or [archetypes.SeriesPoint]. You can do
/// is referenced by [archetypes.SeriesLines] or [archetypes.SeriesPoints]. You can do
/// this by logging both archetypes to the same path, or alternatively configuring
/// the plot-specific archetypes through the blueprint.
///
/// \example archetypes/scalar_simple !api title="Simple line plot" image="https://static.rerun.io/scalar_simple/8bcc92f56268739f8cd24d60d1fe72a655f62a46/1200w.png"
/// \example archetypes/scalar_multiple_plots !api title="Multiple time series plots" image="https://static.rerun.io/scalar_multiple/15845c2a348f875248fbd694e03eabd922741c4c/1200w.png"
/// \example archetypes/scalar_row_updates title="Update a scalar over time" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
/// \example archetypes/scalar_column_updates title="Update a scalar over time, in a single operation" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
/// \example archetypes/scalars_simple !api title="Simple line plot" image="https://static.rerun.io/scalar_simple/8bcc92f56268739f8cd24d60d1fe72a655f62a46/1200w.png"
/// \example archetypes/scalars_multiple_plots !api title="Multiple time series plots" image="https://static.rerun.io/scalar_multiple/15845c2a348f875248fbd694e03eabd922741c4c/1200w.png"
/// \example archetypes/scalars_row_updates title="Update a scalar over time" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
/// \example archetypes/scalars_column_updates title="Update a scalar over time, in a single operation" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
table Scalar (
"attr.rerun.deprecated": "Use `Scalars` instead.",
Copy link
Member

@emilk emilk Mar 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should mandate that we include when this was deprecated ("Deprecated since Rerun 0.23").

"attr.rust.derive": "PartialEq",
"attr.docs.category": "Plotting",
"attr.docs.view_types": "TimeSeriesView"
Expand Down
34 changes: 34 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/scalars.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace rerun.archetypes;

/// One or more double-precision scalar values, e.g. for use for time-series plots.
///
/// The current timeline value will be used for the time/X-axis, hence scalars
/// should not be static.
/// Number of scalars per timestamp is expected to be the same over time.
///
/// When used to produce a plot, this archetype is used to provide the data that
/// is referenced by [archetypes.SeriesLines] or [archetypes.SeriesPoints]. You can do
/// this by logging both archetypes to the same path, or alternatively configuring
/// the plot-specific archetypes through the blueprint.
///
/// \example archetypes/scalars_simple !api title="Simple line plot" image="https://static.rerun.io/scalar_simple/8bcc92f56268739f8cd24d60d1fe72a655f62a46/1200w.png"
/// \example archetypes/scalars_multiple_plots !api title="Multiple time series plots" image="https://static.rerun.io/scalar_multiple/15845c2a348f875248fbd694e03eabd922741c4c/1200w.png"
/// \example archetypes/scalars_row_updates title="Update a scalar over time" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
/// \example archetypes/scalars_column_updates title="Update a scalar over time, in a single operation" image="https://static.rerun.io/transform3d_column_updates/2b7ccfd29349b2b107fcf7eb8a1291a92cf1cafc/1200w.png"
table Scalars (
"attr.docs.unreleased",
"attr.rust.derive": "PartialEq",
"attr.docs.category": "Plotting",
"attr.docs.view_types": "TimeSeriesView"
) {
// --- Required ---

/// The scalar values to log.
scalars: [rerun.components.Scalar] ("attr.rerun.component_required", order: 1000);

// --- Recommended ---

// --- Optional ---

// TODO(#1289): Support labeling points.
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace rerun.archetypes;


/// An image made up of integer [components.ClassId]s.
///
/// Each pixel corresponds to a [components.ClassId] that will be mapped to a color based on annotation context.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
namespace rerun.archetypes;

// ---

/// Define the style properties for a line series in a chart.
///
/// This archetype only provides styling information and should be logged as static
/// when possible. The underlying data needs to be logged to the same entity-path using
/// [archetypes.Scalar].
/// [archetypes.Scalars].
///
/// \example archetypes/series_line_style title="Line series" image="https://static.rerun.io/series_line_style/d2616d98b1e46bdb85849b8669154fdf058e3453/1200w.png"
/// \example archetypes/series_lines_style title="Line series" image="https://static.rerun.io/series_line_style/d2616d98b1e46bdb85849b8669154fdf058e3453/1200w.png"
table SeriesLine (
"attr.rerun.deprecated": "Use `SeriesLines` instead.",
"attr.docs.category": "Plotting",
"attr.docs.view_types": "TimeSeriesView"
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
namespace rerun.archetypes;

/// Define the style properties for one or more line series in a chart.
///
/// This archetype only provides styling information.
/// Changes over time are supported for most but not all its fields (see respective fields for details),
/// it's generally recommended to log this type as static.
///
/// The underlying data needs to be logged to the same entity-path using [archetypes.Scalars].
/// Dimensionality of the scalar arrays logged at each time point is assumed to be the same over time.
///
/// \example archetypes/series_lines_style title="Line series" image="https://static.rerun.io/series_line_style/d2616d98b1e46bdb85849b8669154fdf058e3453/1200w.png"
table SeriesLines (
"attr.docs.unreleased",
"attr.docs.category": "Plotting",
"attr.docs.view_types": "TimeSeriesView"
) {
// --- Required ---

// --- Optional ---

// TODO(#8368, #9334): Once it's trivial to override how scalars for a plot are sourced,
// we should make it explicit that the `SeriesLines`/`SeriesPoints` visualizers require
// scalars as an input.
// Doing so right now would break the model of how time series logging works too much:
// This is a case where we want to encourage data <-> styling separation more than elsewhere,
// so it's important to make keeping it separate easy.
//scalars: [rerun.components.Scalar];

/// Color for the corresponding series.
///
/// May change over time, but can cause discontinuities in the line.
colors: [rerun.components.Color] ("attr.rerun.component_optional", nullable, order: 1000);

/// Stroke width for the corresponding series.
///
/// May change over time, but can cause discontinuities in the line.
widths: [rerun.components.StrokeWidth] ("attr.rerun.component_optional", nullable, order: 2000);

/// Display name of the series.
///
/// Used in the legend. Expected to be unchanging over time.
names: [rerun.components.Name] ("attr.rerun.component_optional", nullable, order: 3000);

/// Which lines are visible.
///
/// If not set, all line series on this entity are visible.
/// Unlike with the regular visibility property of the entire entity, any series that is hidden
/// via this property will still be visible in the legend.
///
/// May change over time, but can cause discontinuities in the line.
visible_series: [rerun.components.SeriesVisible] ("attr.rerun.component_optional", nullable, order: 3100);

/// Configures the zoom-dependent scalar aggregation.
///
/// This is done only if steps on the X axis go below a single pixel,
/// i.e. a single pixel covers more than one tick worth of data. It can greatly improve performance
/// (and readability) in such situations as it prevents overdraw.
///
/// Expected to be unchanging over time.
aggregation_policy: rerun.components.AggregationPolicy ("attr.rerun.component_optional", nullable, order: 4000);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
namespace rerun.archetypes;

// ---

/// Define the style properties for a point series in a chart.
///
/// This archetype only provides styling information and should be logged as static
/// when possible. The underlying data needs to be logged to the same entity-path using
/// [archetypes.Scalar].
/// [archetypes.Scalars].
///
/// \example archetypes/series_point_style title="Point series" image="https://static.rerun.io/series_point_style/82207a705da6c086b28ce161db1db9e8b12258b7/1200w.png"
/// \example archetypes/series_points_style title="Point series" image="https://static.rerun.io/series_point_style/82207a705da6c086b28ce161db1db9e8b12258b7/1200w.png"
table SeriesPoint (
"attr.rerun.deprecated": "Use `SeriesPoints` instead.",
"attr.docs.category": "Plotting",
"attr.docs.view_types": "TimeSeriesView"
) {
Expand Down
Loading
Loading