Skip to content
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

Index column has a null value #7651

Open
abey79 opened this issue Oct 9, 2024 · 2 comments
Open

Index column has a null value #7651

abey79 opened this issue Oct 9, 2024 · 2 comments
Labels
🪳 bug Something isn't working feat-dataframe-api Everything related to the dataframe API

Comments

@abey79
Copy link
Member

abey79 commented Oct 9, 2024

Notice the first two rows with duplicate frame_nr number, even though frame_nr is the index column.

edit: the first row as a null frame_nr value actually (it just happens to be displayed as 0 here for some reason). See my comment below.

image

(Temporary) link to rrd: https://www.swisstransfer.com/d/6de8cb41-311e-41ee-a66d-9eb8827b478e

@abey79 abey79 added 🪳 bug Something isn't working feat-dataframe-api Everything related to the dataframe API labels Oct 9, 2024
@teh-cmc teh-cmc changed the title Index column as a duplicate value Index column has a duplicate value Oct 9, 2024
@teh-cmc
Copy link
Member

teh-cmc commented Oct 9, 2024

Can't repro:

cargo r --all-features -p re_dataframe --example query -- /tmp/face_tracking.rrd frame_nr 0 4 /video/landmarker/faces/0/landmarks

@abey79
Copy link
Member Author

abey79 commented Oct 9, 2024

This repros:

#![allow(clippy::unwrap_used, clippy::match_same_arms)]

use itertools::Itertools;

use re_chunk::TimeInt;
use re_chunk_store::{
    ChunkStore, ChunkStoreConfig, ComponentColumnSelector, QueryExpression, SparseFillStrategy,
    TimeColumnSelector, Timeline, VersionPolicy,
};
use re_dataframe::{QueryCache, QueryEngine};
use re_log_types::{ResolvedTimeRange, StoreKind};

fn main() -> anyhow::Result<()> {
    let args = std::env::args().collect_vec();

    let get_arg = |i| {
        let Some(value) = args.get(i) else {
            eprintln!(
                "Usage: {} <path_to_rrd> [timeline] [from] [to] [entity_path_filter]",
                args.first().map_or("$BIN", |s| s.as_str())
            );
            std::process::exit(1);
        };
        value
    };

    let path_to_rrd = get_arg(1);
    let timeline_name = "frame_nr";
    let time_from = TimeInt::MIN;
    let time_to = TimeInt::try_from(4)?;

    // TODO(cmc): We need to take a selector, not a Timeline.
    let timeline = match timeline_name {
        "log_time" => Timeline::new_temporal(timeline_name),
        "log_tick" => Timeline::new_sequence(timeline_name),
        "frame" => Timeline::new_sequence(timeline_name),
        "frame_nr" => Timeline::new_sequence(timeline_name),
        _ => Timeline::new_temporal(timeline_name),
    };

    let stores = ChunkStore::from_rrd_filepath(
        &ChunkStoreConfig::DEFAULT,
        path_to_rrd,
        VersionPolicy::Warn,
    )?;

    for (store_id, store) in &stores {
        if store_id.kind != StoreKind::Recording {
            continue;
        }

        let query_cache = QueryCache::new(store);
        let query_engine = QueryEngine {
            store,
            cache: &query_cache,
        };

        let mut query = QueryExpression::new(timeline);
        query.view_contents = None;
        query.filtered_index_range = Some(ResolvedTimeRange::new(time_from, time_to));
        query.sparse_fill_strategy = SparseFillStrategy::LatestAtGlobal;
        query.selection = Some(vec![
            TimeColumnSelector {
                timeline: *timeline.name(),
            }
            .into(),
            ComponentColumnSelector::new_for_component_name(
                "/video/landmarker/faces/0/landmarks".into(),
                "rerun.components.Scalar".into(),
            )
            .into(),
        ]);
        eprintln!("{query:#?}:");

        let query_handle = query_engine.query(query.clone());
        // eprintln!("{:#?}", query_handle.selected_contents());
        for batch in query_handle.into_batch_iter() {
            eprintln!("{batch}");
        }
    }

    Ok(())
}

Result:

QueryExpression {
    view_contents: None,
    filtered_index: Timeline {
        name: "frame_nr",
        typ: Sequence,
    },
    filtered_index_range: Some(
        ResolvedTimeRange {
            min: TimeInt::MIN(
                -9223372036854775807,
            ),
            max: TimeInt(4),
        },
    ),
    filtered_index_values: None,
    using_index_values: None,
    filtered_point_of_view: None,
    sparse_fill_strategy: LatestAtGlobal,
    selection: Some(
        [
            Time(
                TimeColumnSelector {
                    timeline: "frame_nr",
                },
            ),
            Component(
                ComponentColumnSelector {
                    entity_path: /video/landmarker/faces/0/landmarks,
                    component: "rerun.components.Scalar",
                    join_encoding: OverlappingSlice,
                },
            ),
        ],
    ),
}:
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ -           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ 0           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ 1           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ 2           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ 3           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────┐
│ CHUNK METADATA:                                                      │
│                                                                      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌─────────────┬────────────────────────────────────────────────────┐ │
│ │ frame_nr    ┆ /video/landmarker/faces/0/landmarks:Scalar         │ │
│ │ ---         ┆ ---                                                │ │
│ │ type: "i64" ┆ type: "null"                                       │ │
│ │             ┆ sorbet.path: "/video/landmarker/faces/0/landmarks" │ │
│ │             ┆ sorbet.semantic_type: "Scalar"                     │ │
│ ╞═════════════╪════════════════════════════════════════════════════╡ │
│ │ 4           ┆ -                                                  │ │
│ └─────────────┴────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────┘

@abey79 abey79 changed the title Index column has a duplicate value Index column has a null value Oct 9, 2024
@abey79 abey79 changed the title Index column has a null value Index column has a null value in some rrd Oct 9, 2024
@abey79 abey79 changed the title Index column has a null value in some rrd Index column has a null value Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working feat-dataframe-api Everything related to the dataframe API
Projects
None yet
Development

No branches or pull requests

2 participants