MCPcopy Create free account
hub / github.com/apache/paimon-rust / resolve_snapshot

Method resolve_snapshot

crates/paimon/src/table/table_scan.rs:381–419  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

379 }
380
381 async fn resolve_snapshot(&self) -> crate::Result<Option<Snapshot>> {
382 let file_io = self.table.file_io();
383 let table_path = self.table.location();
384 let snapshot_manager = SnapshotManager::new(file_io.clone(), table_path.to_string());
385 let core_options = CoreOptions::new(self.table.schema().options());
386
387 match core_options.try_time_travel_selector()? {
388 Some(TimeTravelSelector::TimestampMillis(ts)) => {
389 match snapshot_manager.earlier_or_equal_time_millis(ts).await? {
390 Some(s) => Ok(Some(s)),
391 None => Err(Error::DataInvalid {
392 message: format!("No snapshot found with timestamp <= {ts}"),
393 source: None,
394 }),
395 }
396 }
397 Some(TimeTravelSelector::Version(v)) => {
398 // Tag first, then snapshot id, else error.
399 let tag_manager = TagManager::new(file_io.clone(), table_path.to_string());
400 if tag_manager.tag_exists(v).await? {
401 match tag_manager.get(v).await? {
402 Some(s) => Ok(Some(s)),
403 None => Err(Error::DataInvalid {
404 message: format!("Tag '{v}' doesn't exist."),
405 source: None,
406 }),
407 }
408 } else if let Ok(id) = v.parse::<i64>() {
409 snapshot_manager.get_snapshot(id).await.map(Some)
410 } else {
411 Err(Error::DataInvalid {
412 message: format!("Version '{v}' is not a valid tag name or snapshot id."),
413 source: None,
414 })
415 }
416 }
417 None => snapshot_manager.get_latest_snapshot().await,
418 }
419 }
420
421 /// Apply a limit-pushdown hint to the generated splits.
422 ///

Callers 1

planMethod · 0.80

Calls 10

tag_existsMethod · 0.80
get_snapshotMethod · 0.80
get_latest_snapshotMethod · 0.80
file_ioMethod · 0.45
locationMethod · 0.45
optionsMethod · 0.45
schemaMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected