File tree Expand file tree Collapse file tree 4 files changed +1192
-2
lines changed
Expand file tree Collapse file tree 4 files changed +1192
-2
lines changed Original file line number Diff line number Diff line change @@ -384,6 +384,9 @@ const std::shared_ptr<TableMetadata>& TableScan::metadata() const { return metad
384384Result<std::shared_ptr<Snapshot>> TableScan::snapshot () const {
385385 auto snapshot_id = context_.snapshot_id ? context_.snapshot_id .value ()
386386 : metadata_->current_snapshot_id ;
387+ if (snapshot_id == kInvalidSnapshotId ) {
388+ return std::shared_ptr<Snapshot>{nullptr };
389+ }
387390 return metadata_->SnapshotById (snapshot_id);
388391}
389392
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 @@ -162,7 +162,11 @@ if(ICEBERG_BUILD_BUNDLE)
162162 parquet_schema_test.cc
163163 parquet_test.cc )
164164
165- add_iceberg_test (scan_test USE_BUNDLE SOURCES file_scan_task_test.cc )
165+ add_iceberg_test (scan_test
166+ USE_BUNDLE
167+ SOURCES
168+ file_scan_task_test.cc
169+ table_scan_test.cc )
166170
167171 add_iceberg_test (table_update_test
168172 USE_BUNDLE
You can’t perform that action at this time.
0 commit comments