MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / write_large_ts_segment

Function write_large_ts_segment

nodedb/src/engine/timeseries/columnar_bridge.rs:471–486  ·  view source on GitHub ↗

Write a segment whose timestamp column uses values far above 2^53. These values are not exactly representable in f64, so the old `ScanPredicate::gte(ts_col_idx, start_ms as f64)` path would round the predicate and produce incorrect block-skip decisions.

(start_ts: i64, count: usize)

Source from the content-addressed store, hash-verified

469 /// `ScanPredicate::gte(ts_col_idx, start_ms as f64)` path would round
470 /// the predicate and produce incorrect block-skip decisions.
471 fn write_large_ts_segment(start_ts: i64, count: usize) -> Vec<u8> {
472 let mut mt = ColumnarMemtable::new_metric(default_config());
473 for i in 0..count {
474 let ts = start_ts + i as i64;
475 let result = mt.ingest_metric(
476 (i % 3) as u64,
477 MetricSample {
478 timestamp_ms: ts,
479 value: i as f64,
480 },
481 );
482 assert_ne!(result, nodedb_types::timeseries::IngestResult::Rejected);
483 }
484 let drain = mt.drain();
485 write_ts_drain_as_segment(&drain, None).expect("write large-ts segment")
486 }
487
488 /// end-to-end block skip with timestamps outside ±2^53.
489 ///

Calls 5

default_configFunction · 0.70
ingest_metricMethod · 0.45
drainMethod · 0.45
expectMethod · 0.45