Skip to content

Commit 5001e07

Browse files
authored
Merge branch 'main' into ctty/df-insert
2 parents 1ea4a0f + 9787140 commit 5001e07

File tree

5 files changed

+70
-42
lines changed

5 files changed

+70
-42
lines changed

.github/workflows/release_python.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,19 @@ jobs:
8787
steps:
8888
- uses: actions/checkout@v4
8989

90-
- name: Install cargo-edit
90+
- name: Install toml-cli
9191
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
92-
run: cargo install cargo-edit
92+
run: cargo install toml-cli
9393

9494
- name: Set cargo version for RC
9595
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
9696
working-directory: "bindings/python"
9797
run: |
9898
echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
99-
cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
99+
toml set Cargo.toml package.version ${{ needs.validate-release-tag.outputs.cargo-version }} > Cargo.toml.tmp
100+
# doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
101+
rm Cargo.toml
102+
mv Cargo.toml.tmp Cargo.toml
100103
101104
- uses: PyO3/maturin-action@v1
102105
with:
@@ -127,16 +130,19 @@ jobs:
127130
steps:
128131
- uses: actions/checkout@v4
129132

130-
- name: Install cargo-edit
133+
- name: Install toml-cli
131134
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
132-
run: cargo install cargo-edit
135+
run: cargo install toml-cli
133136

134137
- name: Set cargo version for RC
135138
if: ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
136139
working-directory: "bindings/python"
137140
run: |
138141
echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
139-
cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
142+
toml set Cargo.toml package.version ${{ needs.validate-release-tag.outputs.cargo-version }} > Cargo.toml.tmp
143+
# doing this explicitly to avoid issue in Windows where `mv` does not overwrite existing file
144+
rm Cargo.toml
145+
mv Cargo.toml.tmp Cargo.toml
140146
141147
- uses: actions/setup-python@v5
142148
with:

crates/iceberg/src/catalog/mod.rs

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -597,111 +597,120 @@ impl TableRequirement {
597597
match self {
598598
TableRequirement::NotExist => {
599599
return Err(Error::new(
600-
ErrorKind::DataInvalid,
600+
ErrorKind::CatalogCommitConflicts,
601601
format!(
602602
"Requirement failed: Table with id {} already exists",
603603
metadata.uuid()
604604
),
605-
));
605+
)
606+
.with_retryable(true));
606607
}
607608
TableRequirement::UuidMatch { uuid } => {
608609
if &metadata.uuid() != uuid {
609610
return Err(Error::new(
610-
ErrorKind::DataInvalid,
611+
ErrorKind::CatalogCommitConflicts,
611612
"Requirement failed: Table UUID does not match",
612613
)
613614
.with_context("expected", *uuid)
614-
.with_context("found", metadata.uuid()));
615+
.with_context("found", metadata.uuid())
616+
.with_retryable(true));
615617
}
616618
}
617619
TableRequirement::CurrentSchemaIdMatch { current_schema_id } => {
618620
// ToDo: Harmonize the types of current_schema_id
619621
if metadata.current_schema_id != *current_schema_id {
620622
return Err(Error::new(
621-
ErrorKind::DataInvalid,
623+
ErrorKind::CatalogCommitConflicts,
622624
"Requirement failed: Current schema id does not match",
623625
)
624626
.with_context("expected", current_schema_id.to_string())
625-
.with_context("found", metadata.current_schema_id.to_string()));
627+
.with_context("found", metadata.current_schema_id.to_string())
628+
.with_retryable(true));
626629
}
627630
}
628631
TableRequirement::DefaultSortOrderIdMatch {
629632
default_sort_order_id,
630633
} => {
631634
if metadata.default_sort_order().order_id != *default_sort_order_id {
632635
return Err(Error::new(
633-
ErrorKind::DataInvalid,
636+
ErrorKind::CatalogCommitConflicts,
634637
"Requirement failed: Default sort order id does not match",
635638
)
636639
.with_context("expected", default_sort_order_id.to_string())
637-
.with_context(
638-
"found",
639-
metadata.default_sort_order().order_id.to_string(),
640-
));
640+
.with_context("found", metadata.default_sort_order().order_id.to_string())
641+
.with_retryable(true));
641642
}
642643
}
643644
TableRequirement::RefSnapshotIdMatch { r#ref, snapshot_id } => {
644645
let snapshot_ref = metadata.snapshot_for_ref(r#ref);
645646
if let Some(snapshot_id) = snapshot_id {
646-
let snapshot_ref = snapshot_ref.ok_or(Error::new(
647-
ErrorKind::DataInvalid,
648-
format!("Requirement failed: Branch or tag `{}` not found", r#ref),
649-
))?;
647+
let snapshot_ref = snapshot_ref.ok_or(
648+
Error::new(
649+
ErrorKind::CatalogCommitConflicts,
650+
format!("Requirement failed: Branch or tag `{}` not found", r#ref),
651+
)
652+
.with_retryable(true),
653+
)?;
650654
if snapshot_ref.snapshot_id() != *snapshot_id {
651655
return Err(Error::new(
652-
ErrorKind::DataInvalid,
656+
ErrorKind::CatalogCommitConflicts,
653657
format!(
654658
"Requirement failed: Branch or tag `{}`'s snapshot has changed",
655659
r#ref
656660
),
657661
)
658662
.with_context("expected", snapshot_id.to_string())
659-
.with_context("found", snapshot_ref.snapshot_id().to_string()));
663+
.with_context("found", snapshot_ref.snapshot_id().to_string())
664+
.with_retryable(true));
660665
}
661666
} else if snapshot_ref.is_some() {
662667
// a null snapshot ID means the ref should not exist already
663668
return Err(Error::new(
664-
ErrorKind::DataInvalid,
669+
ErrorKind::CatalogCommitConflicts,
665670
format!(
666671
"Requirement failed: Branch or tag `{}` already exists",
667672
r#ref
668673
),
669-
));
674+
)
675+
.with_retryable(true));
670676
}
671677
}
672678
TableRequirement::DefaultSpecIdMatch { default_spec_id } => {
673679
// ToDo: Harmonize the types of default_spec_id
674680
if metadata.default_partition_spec_id() != *default_spec_id {
675681
return Err(Error::new(
676-
ErrorKind::DataInvalid,
682+
ErrorKind::CatalogCommitConflicts,
677683
"Requirement failed: Default partition spec id does not match",
678684
)
679685
.with_context("expected", default_spec_id.to_string())
680-
.with_context("found", metadata.default_partition_spec_id().to_string()));
686+
.with_context("found", metadata.default_partition_spec_id().to_string())
687+
.with_retryable(true));
681688
}
682689
}
683690
TableRequirement::LastAssignedPartitionIdMatch {
684691
last_assigned_partition_id,
685692
} => {
686693
if metadata.last_partition_id != *last_assigned_partition_id {
687694
return Err(Error::new(
688-
ErrorKind::DataInvalid,
695+
ErrorKind::CatalogCommitConflicts,
689696
"Requirement failed: Last assigned partition id does not match",
690697
)
691698
.with_context("expected", last_assigned_partition_id.to_string())
692-
.with_context("found", metadata.last_partition_id.to_string()));
699+
.with_context("found", metadata.last_partition_id.to_string())
700+
.with_retryable(true));
693701
}
694702
}
695703
TableRequirement::LastAssignedFieldIdMatch {
696704
last_assigned_field_id,
697705
} => {
698706
if &metadata.last_column_id != last_assigned_field_id {
699707
return Err(Error::new(
700-
ErrorKind::DataInvalid,
708+
ErrorKind::CatalogCommitConflicts,
701709
"Requirement failed: Last assigned field id does not match",
702710
)
703711
.with_context("expected", last_assigned_field_id.to_string())
704-
.with_context("found", metadata.last_column_id.to_string()));
712+
.with_context("found", metadata.last_column_id.to_string())
713+
.with_retryable(true));
705714
}
706715
}
707716
};
@@ -710,7 +719,7 @@ impl TableRequirement {
710719
TableRequirement::NotExist => {}
711720
_ => {
712721
return Err(Error::new(
713-
ErrorKind::DataInvalid,
722+
ErrorKind::TableNotFound,
714723
"Requirement failed: Table does not exist",
715724
));
716725
}
@@ -814,7 +823,7 @@ pub enum ViewUpdate {
814823
#[serde(rename_all = "kebab-case")]
815824
AssignUuid {
816825
/// The new UUID to assign.
817-
uuid: uuid::Uuid,
826+
uuid: Uuid,
818827
},
819828
/// Upgrade view's format version
820829
#[serde(rename_all = "kebab-case")]
@@ -1092,7 +1101,7 @@ mod tests {
10921101
.unwrap()
10931102
.metadata;
10941103

1095-
// Ref exists and should matches
1104+
// Ref exists and should match
10961105
let requirement = TableRequirement::RefSnapshotIdMatch {
10971106
r#ref: "main".to_string(),
10981107
snapshot_id: Some(3051729675574597004),

crates/iceberg/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub enum ErrorKind {
5353
/// Iceberg namespace already exists at creation.
5454
NamespaceNotFound,
5555

56-
/// Iceberg table already exists at creation.
56+
/// Iceberg table does not exist.
5757
TableNotFound,
5858

5959
/// Iceberg feature is not supported.
@@ -278,7 +278,7 @@ impl Error {
278278
/// If you just want to print error with backtrace, use `Debug`, like `format!("{err:?}")`.
279279
///
280280
/// If you use nightly rust, and want to access `iceberg::Error`'s backtrace in the standard way, you can
281-
/// implement a newtype like this:
281+
/// implement a new type like this:
282282
///
283283
/// ```ignore
284284
/// // assume you already have `#![feature(error_generic_member_access)]` on the top of your crate

crates/iceberg/src/table.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,23 @@ impl StaticTable {
271271
}
272272
/// Creates a static table directly from metadata file and `FileIO`
273273
pub async fn from_metadata_file(
274-
metadata_file_path: &str,
274+
metadata_location: &str,
275275
table_ident: TableIdent,
276276
file_io: FileIO,
277277
) -> Result<Self> {
278-
let metadata_file = file_io.new_input(metadata_file_path)?;
278+
let metadata_file = file_io.new_input(metadata_location)?;
279279
let metadata_file_content = metadata_file.read().await?;
280-
let table_metadata = serde_json::from_slice::<TableMetadata>(&metadata_file_content)?;
281-
Self::from_metadata(table_metadata, table_ident, file_io).await
280+
let metadata = serde_json::from_slice::<TableMetadata>(&metadata_file_content)?;
281+
282+
let table = Table::builder()
283+
.metadata(metadata)
284+
.metadata_location(metadata_location)
285+
.identifier(table_ident)
286+
.file_io(file_io.clone())
287+
.readonly(true)
288+
.build();
289+
290+
Ok(Self(table?))
282291
}
283292

284293
/// Create a TableScanBuilder for the static table.
@@ -356,6 +365,10 @@ mod tests {
356365
let table = static_table.into_table();
357366
assert!(table.readonly());
358367
assert_eq!(table.identifier.name(), "static_table");
368+
assert_eq!(
369+
table.metadata_location(),
370+
Some(metadata_file_path).as_deref()
371+
);
359372
}
360373

361374
#[tokio::test]

website/src/release.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ https://downloads.apache.org/iceberg/KEYS
231231
232232
Git tag for the release:
233233
234-
https://github.com/apache/iceberg-rust/releases/tag/${release_version}
234+
https://github.com/apache/iceberg-rust/releases/tag/v${iceberg_version}
235235
236236
Please download, verify, and test.
237237
@@ -317,7 +317,7 @@ curl https://downloads.apache.org/iceberg/KEYS -o KEYS
317317
gpg --import KEYS
318318
```
319319
* Verify the `.asc` file: ```gpg --verify apache-iceberg-rust-${iceberg_version}.tar.gz.asc```
320-
* Verify the checksums: ```shasum -a 512 apache-iceberg-rust-${iceberg_version}.tar.gz.sha512```
320+
* Verify the checksums: ```shasum -a 512 -c apache-iceberg-rust-${iceberg_version}.tar.gz.sha512```
321321
* Verify build and test:
322322
```bash
323323
tar -xzf apache-iceberg-rust-${iceberg_version}.tar.gz

0 commit comments

Comments
 (0)