Skip to content

Commit 9bc9baf

Browse files
committed
Thanks Scott!
1 parent fb44a0a commit 9bc9baf

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

bindings/python/src/manifest.rs

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use iceberg::spec::{DataContentType, DataFile, DataFileFormat, FieldSummary, FormatVersion, Literal, Manifest, ManifestContentType, ManifestEntry, ManifestFile, ManifestList, ManifestStatus, PrimitiveLiteral, StructType, Type};
18+
use iceberg::spec::{DataFile, DataFileFormat, FieldSummary, FormatVersion, Literal, Manifest, ManifestEntry, ManifestFile, ManifestList, ManifestStatus, PrimitiveLiteral, StructType, Type};
19+
use iceberg::{Error, ErrorKind};
1920
use pyo3::prelude::*;
21+
use pyo3::types::PyAny;
2022
use std::collections::HashMap;
2123
use std::sync::Arc;
22-
use pyo3::types::PyAny;
23-
use iceberg::{Error, ErrorKind};
2424

2525
#[pyclass]
2626
pub struct PyLiteral {
@@ -44,13 +44,7 @@ impl PyDataFile {
4444

4545
#[getter]
4646
fn content(&self) -> i32 {
47-
// TODO: Maps the enum back to the int
48-
// I have a feeling this can be done more intelligently
49-
match self.inner.content_type() {
50-
DataContentType::Data => 0,
51-
DataContentType::PositionDeletes => 1,
52-
DataContentType::EqualityDeletes => 2,
53-
}
47+
self.inner.content_type() as i32
5448
}
5549

5650
#[getter]
@@ -60,8 +54,6 @@ impl PyDataFile {
6054

6155
#[getter]
6256
fn file_format(&self) -> &str {
63-
// TODO: Maps the enum back to the int
64-
// I have a feeling this can be done more intelligently
6557
match self.inner.file_format() {
6658
DataFileFormat::Avro => "avro",
6759
DataFileFormat::Orc => "orc",
@@ -214,12 +206,7 @@ impl crate::manifest::PyManifestFile {
214206

215207
#[getter]
216208
fn content(&self) -> i32 {
217-
// TODO: Maps the enum back to the int
218-
// I have a feeling this can be done more intelligently
219-
match self.inner.content {
220-
ManifestContentType::Data => 0,
221-
ManifestContentType::Deletes => 1,
222-
}
209+
self.inner.content as i32
223210
}
224211

225212
#[getter]
@@ -293,13 +280,7 @@ impl PyManifestEntry {
293280

294281
#[getter]
295282
fn status(&self) -> i32 {
296-
// TODO: Maps the enum back to the int
297-
// I have a feeling this can be done more intelligently
298-
match self.inner.status {
299-
ManifestStatus::Existing => 0,
300-
ManifestStatus::Added => 1,
301-
ManifestStatus::Deleted => 2,
302-
}
283+
ManifestStatus::Existing as i32
303284
}
304285

305286
#[getter]

0 commit comments

Comments
 (0)