Skip to content

Commit

Permalink
Use full chunk table format for snapshot tests (#8699)
Browse files Browse the repository at this point in the history
* Part of #3741 

Will make it easier to switch out the `TransportChunk` for an
`RecordBatch` and still have the same test output
  • Loading branch information
emilk authored Jan 15, 2025
1 parent d0a7d1f commit ac80fbc
Show file tree
Hide file tree
Showing 23 changed files with 547 additions and 197 deletions.
51 changes: 28 additions & 23 deletions crates/store/re_dataframe/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1323,7 +1323,6 @@ impl<E: StorageEngineLike> QueryHandle<E> {
mod tests {
use std::sync::Arc;

use insta::assert_debug_snapshot;
use re_chunk::{
concat_record_batches::concatenate_record_batches, Chunk, ChunkId, RowId, TimePoint,
TransportChunk,
Expand All @@ -1344,6 +1343,12 @@ mod tests {

use super::*;

macro_rules! assert_snapshot_fixed_width {
($($arg:tt)*) => {
insta::_assert_snapshot_base!(transform=|v| std::format!("{v:200}"), $($arg)*)
};
}

// NOTE: The best way to understand what these tests are doing is to run them in verbose mode,
// e.g. `cargo t -p re_dataframe -- --show-output barebones`.
// Each test will print the state of the store, the query being run, and the results that were
Expand Down Expand Up @@ -1399,7 +1404,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// temporal
Expand All @@ -1421,7 +1426,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -1455,7 +1460,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);

Ok(())
}
Expand Down Expand Up @@ -1488,7 +1493,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);

Ok(())
}
Expand Down Expand Up @@ -1527,7 +1532,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);

Ok(())
}
Expand Down Expand Up @@ -1569,7 +1574,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// sparse-filled
Expand Down Expand Up @@ -1599,7 +1604,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -1640,7 +1645,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// non-existing component
Expand All @@ -1666,7 +1671,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// MyPoint
Expand All @@ -1692,7 +1697,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// MyColor
Expand All @@ -1718,7 +1723,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -1760,7 +1765,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

{
Expand Down Expand Up @@ -1797,7 +1802,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -1835,7 +1840,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// only indices (+ duplication)
Expand Down Expand Up @@ -1868,7 +1873,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// only components (+ duplication)
Expand Down Expand Up @@ -1908,7 +1913,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// static
Expand Down Expand Up @@ -1969,7 +1974,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -2038,7 +2043,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -2078,7 +2083,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

// sparse-filled
Expand Down Expand Up @@ -2106,7 +2111,7 @@ mod tests {
// static clear semantics in general are pretty unhinged right now, especially when
// ranges are involved.
// It's extremely niche, our time is better spent somewhere else right now.
assert_debug_snapshot!(dataframe.columns());
assert_snapshot_fixed_width!(dataframe);
}

Ok(())
Expand Down Expand Up @@ -2344,7 +2349,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!("async_barebones_static", dataframe.columns());
assert_snapshot_fixed_width!("async_barebones_static", dataframe);

Ok::<_, anyhow::Error>(())
}
Expand Down Expand Up @@ -2375,7 +2380,7 @@ mod tests {
)?;
eprintln!("{dataframe}");

assert_debug_snapshot!("async_barebones_temporal", dataframe.columns());
assert_snapshot_fixed_width!("async_barebones_temporal", dataframe);

Ok::<_, anyhow::Error>(())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
---
source: crates/store/re_dataframe/src/query.rs
assertion_line: 2347
expression: dataframe.columns()
assertion_line: 2353
expression: dataframe
snapshot_kind: text
---
[
Int64[None],
Timestamp(Nanosecond, None)[None],
ListArray[None],
ListArray[[c]],
ListArray[None],
]
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
CHUNK METADATA: │
│ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ ┌───────────────────────────────┬───────────────────────────────┬──────────────────────────────────────┬──────────────────────────────────────┬──────────────────────────────────────┐ │
│ │ frame_nrlog_time/this/that:example.MyColor/this/that:example.MyLabel/this/that:example.MyPoint │ │
│ │ --------------- │ │
│ │ type: "i64"type: "Timestamp(ns)"type: "List[u32]"type: "List[Utf8]"type: "List[Struct[2]]" │ │
│ │ sorbet.index_name: "frame_nr"sorbet.index_name: "log_time"sorbet.path: "/this/that"sorbet.is_static: "yes"sorbet.path: "/this/that" │ │
│ │ ┆ ┆ sorbet.semantic_type: ┆ sorbet.path: "/this/that"sorbet.semantic_type: │ │
│ │ ┆ ┆ "example.MyColor"sorbet.semantic_type: ┆ "example.MyPoint" │ │
│ │ ┆ ┆ ┆ "example.MyLabel" ┆ │ │
│ ╞═══════════════════════════════╪═══════════════════════════════╪══════════════════════════════════════╪══════════════════════════════════════╪══════════════════════════════════════╡ │
│ │ ┆ ┆ ┆ [c] ┆ │ │
│ └───────────────────────────────┴───────────────────────────────┴──────────────────────────────────────┴──────────────────────────────────────┴──────────────────────────────────────┘ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Loading

0 comments on commit ac80fbc

Please sign in to comment.