Skip to content

Commit

Permalink
feat: rewrite operations
Browse files Browse the repository at this point in the history
  • Loading branch information
roeap committed Sep 27, 2022
1 parent 7824a37 commit 504bfd5
Show file tree
Hide file tree
Showing 15 changed files with 1,533 additions and 1,150 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "deltalake"
version = "0.4.1"
rust-version = "1.64"
authors = ["Qingping Hou <[email protected]>"]
homepage = "https://github.com/delta-io/delta.rs"
license = "Apache-2.0"
Expand All @@ -23,14 +24,15 @@ num-bigint = "0.4"
num-traits = "0.2.15"
object_store = "0.5.0"
once_cell = "1.15.0"
parking_lot = "0.12"
parquet = { version = "22", features = ["async"], optional = true }
parquet2 = { version = "0.16", optional = true }
parquet-format = { version = "~4.0.0" }
percent-encoding = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1"
tokio = { version = "1", features = ["macros", "rt"] }
tokio = { version = "1", features = ["macros", "rt", "parking_lot"] }
regex = "1"
uuid = { version = "1", features = ["serde", "v4"] }
url = "2.3"
Expand Down
29 changes: 17 additions & 12 deletions rust/src/delta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::partitions::{DeltaTablePartition, PartitionFilter};
use super::schema::*;
use super::table_state::DeltaTableState;
use crate::action::{Add, Stats};
use crate::builder::{DeltaTableBuilder, DeltaTableConfig};
use crate::delta_config::DeltaConfigError;
use crate::storage::ObjectStoreRef;
use crate::vacuum::{Vacuum, VacuumError};
Expand All @@ -28,8 +29,6 @@ use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use uuid::Uuid;

pub use crate::builder::{DeltaTableBuilder, DeltaTableConfig, DeltaVersion};

/// Metadata for a checkpoint file
#[derive(Serialize, Deserialize, Debug, Default, Clone, Copy)]
pub struct CheckPoint {
Expand Down Expand Up @@ -85,22 +84,20 @@ pub enum DeltaTableError {
#[from]
source: ObjectStoreError,
},
/// Error returned when reading the checkpoint failed.
#[cfg(feature = "parquet")]
#[error("Failed to read checkpoint: {}", .source)]

/// Error returned when parsing checkpoint parquet.
// #[cfg(feature = "parquet")]
#[error("Failed to parse parquet: {}", .source)]
Parquet {
/// Parquet error details returned when reading the checkpoint failed.
#[cfg(feature = "parquet")]
#[from]
source: parquet::errors::ParquetError,
},
/// Error returned when parsing checkpoint parquet using parquet2 crate.
#[cfg(feature = "parquet2")]
#[error("Failed to parse parquet: {}", .source)]
Parquet {
/// Parquet error details returned when parsing the checkpoint parquet
#[cfg(feature = "parquet2")]
#[from]
source: parquet2::error::Error,
},

/// Error returned when converting the schema in Arrow format failed.
#[cfg(feature = "arrow")]
#[error("Failed to convert into Arrow schema: {}", .source)]
Expand All @@ -109,6 +106,7 @@ pub enum DeltaTableError {
#[from]
source: arrow::error::ArrowError,
},

/// Error returned when the log record has an invalid JSON.
#[error("Invalid JSON in log record: {}", .source)]
InvalidJson {
Expand Down Expand Up @@ -191,6 +189,12 @@ pub enum DeltaTableError {
/// Generic Delta Table error
#[error("Generic DeltaTable error: {0}")]
Generic(String),
/// Generic Delta Table error
#[error("Generic error: {source}")]
GenericError {
/// Source error
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
}

/// Delta table metadata
Expand Down Expand Up @@ -410,8 +414,9 @@ pub struct DeltaTable {
/// the load options used during load
pub config: DeltaTableConfig,
pub(crate) storage: ObjectStoreRef,

/// file metadata for latest checkpoint
last_check_point: Option<CheckPoint>,
/// table versions associated with timestamps
version_timestamp: HashMap<DeltaDataTypeVersion, i64>,
}

Expand Down
3 changes: 2 additions & 1 deletion rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub mod delta_config;
pub mod partitions;
pub mod schema;
pub mod storage;
pub mod table_properties;
pub mod table_state;
pub mod time_utils;
pub mod vacuum;
Expand All @@ -99,7 +100,7 @@ pub mod checkpoints;
pub mod delta_arrow;
#[cfg(feature = "datafusion-ext")]
pub mod delta_datafusion;
#[cfg(feature = "datafusion-ext")]
#[cfg(all(feature = "arrow", feature = "parquet"))]
pub mod operations;
#[cfg(feature = "parquet")]
pub mod optimize;
Expand Down
Loading

0 comments on commit 504bfd5

Please sign in to comment.