File tree Expand file tree Collapse file tree 4 files changed +680
-2
lines changed
Expand file tree Collapse file tree 4 files changed +680
-2
lines changed Original file line number Diff line number Diff line change @@ -383,6 +383,9 @@ const std::shared_ptr<TableMetadata>& TableScan::metadata() const { return metad
383383Result<std::shared_ptr<Snapshot>> TableScan::snapshot () const {
384384 auto snapshot_id = context_.snapshot_id ? context_.snapshot_id .value ()
385385 : metadata_->current_snapshot_id ;
386+ if (snapshot_id == kInvalidSnapshotId ) {
387+ return std::shared_ptr<Snapshot>{nullptr };
388+ }
386389 return metadata_->SnapshotById (snapshot_id);
387390}
388391
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ class ICEBERG_EXPORT TableScan {
275275 // / \brief Returns the table metadata being scanned.
276276 const std::shared_ptr<TableMetadata>& metadata () const ;
277277
278- // / \brief Returns the snapshot to scan.
278+ // / \brief Returns the snapshot to scan. If there is no snapshot, returns nullptr.
279279 Result<std::shared_ptr<Snapshot>> snapshot () const ;
280280
281281 // / \brief Returns the projected schema for the scan.
Original file line number Diff line number Diff line change @@ -167,7 +167,11 @@ if(ICEBERG_BUILD_BUNDLE)
167167 parquet_schema_test.cc
168168 parquet_test.cc)
169169
170- add_iceberg_test(scan_test USE_BUNDLE SOURCES file_scan_task_test.cc)
170+ add_iceberg_test(scan_test
171+ USE_BUNDLE
172+ SOURCES
173+ file_scan_task_test.cc
174+ table_scan_test.cc)
171175
172176 add_iceberg_test(table_update_test
173177 USE_BUNDLE
You can’t perform that action at this time.
0 commit comments