Skip to content

Commit

Permalink
Allow user to define partition column schema
Browse files Browse the repository at this point in the history
- Allow user to define partition column schema
- Refactor unit tests
  • Loading branch information
junjunjd committed Oct 14, 2023
1 parent 826db3f commit e4cae43
Show file tree
Hide file tree
Showing 2 changed files with 338 additions and 360 deletions.
17 changes: 16 additions & 1 deletion rust/src/schema/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::borrow::Cow;
use std::borrow::{Borrow, Cow};
use std::collections::HashMap;
use std::hash::{Hash, Hasher};

use crate::errors::DeltaTableError;

Expand Down Expand Up @@ -165,6 +166,20 @@ pub struct SchemaField {
metadata: HashMap<String, Value>,
}

impl Hash for SchemaField {
fn hash<H: Hasher>(&self, state: &mut H) {
self.name.hash(state);
}
}

impl Borrow<str> for SchemaField {
fn borrow(&self) -> &str {
self.name.as_ref()
}
}

impl Eq for SchemaField {}

impl SchemaField {
/// Create a new SchemaField from scratch
pub fn new(
Expand Down
Loading

0 comments on commit e4cae43

Please sign in to comment.