diff --git a/rerun_py/src/dataframe.rs b/rerun_py/src/dataframe.rs index 1e62658efb62..4a6e9650a3ab 100644 --- a/rerun_py/src/dataframe.rs +++ b/rerun_py/src/dataframe.rs @@ -523,17 +523,35 @@ impl PyRecordingView { let query_handle = engine.query(query_expression); + // If the only contents found are static, we might need to warn the user since + // this means we won't naturally have any rows in the result. let available_data_columns = query_handle .view_contents() .iter() .filter(|c| matches!(c, ColumnDescriptor::Component(_))) .collect::>(); + // We only consider all contents static if there at least some columns + let all_contents_are_static = !available_data_columns.is_empty() + && available_data_columns.iter().all(|c| c.is_static()); + + // Additionally, we only want to warn if the user actually tried to select some + // of the static columns. Otherwise the fact that there are no results shouldn't + // be surprising. + let selected_data_columns = query_handle + .selected_contents() + .iter() + .map(|(_, col)| col) + .filter(|c| matches!(c, ColumnDescriptor::Component(_))) + .collect::>(); + + let any_selected_data_is_static = selected_data_columns.iter().any(|c| c.is_static()); + if self.query_expression.using_index_values.is_none() - && !available_data_columns.is_empty() - && available_data_columns.iter().all(|c| c.is_static()) + && all_contents_are_static + && any_selected_data_is_static { - py_rerun_warn("RecordingView::select: contents only include static columns. No results will be returned. Either include non-static data or consider using `select_static()` instead.")?; + py_rerun_warn("RecordingView::select: tried to select static data, but no non-static contents generated an index value on this timeline. No results will be returned. Either include non-static data or consider using `select_static()` instead.")?; } let schema = query_handle.schema();