Skip to content

Commit

Permalink
remove properties field from mdl
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Oct 29, 2024
1 parent 7a83eda commit 4ec91ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 65 deletions.
10 changes: 5 additions & 5 deletions wren-core-py/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@ impl From<CoreError> for PyErr {

impl From<PyErr> for CoreError {
fn from(err: PyErr) -> Self {
CoreError::new(&err.to_string())
CoreError::new(&format!("PyError: {}", &err))
}
}

impl From<DecodeError> for CoreError {
fn from(err: DecodeError) -> Self {
CoreError::new(&err.to_string())
CoreError::new(&format!("Base64 decode error: {}", err))
}
}

impl From<FromUtf8Error> for CoreError {
fn from(err: FromUtf8Error) -> Self {
CoreError::new(&err.to_string())
CoreError::new(&format!("FromUtf8Error: {}", err))
}
}

impl From<serde_json::Error> for CoreError {
fn from(err: serde_json::Error) -> Self {
CoreError::new(&err.to_string())
CoreError::new(&format!("Serde JSON error: {}", err))
}
}

impl From<wren_core::DataFusionError> for CoreError {
fn from(err: wren_core::DataFusionError) -> Self {
CoreError::new(&err.to_string())
CoreError::new(&format!("DataFusion error: {}", err))
}
}
50 changes: 0 additions & 50 deletions wren-core/core/src/mdl/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ impl ModelBuilder {
primary_key: None,
cached: false,
refresh_time: None,
properties: BTreeMap::default(),
},
}
}
Expand Down Expand Up @@ -122,13 +121,6 @@ impl ModelBuilder {
self
}

pub fn property(mut self, key: &str, value: &str) -> Self {
self.model
.properties
.insert(key.to_string(), value.to_string());
self
}

pub fn build(self) -> Arc<Model> {
Arc::new(self.model)
}
Expand All @@ -148,7 +140,6 @@ impl ColumnBuilder {
is_calculated: false,
not_null: false,
expression: None,
properties: BTreeMap::default(),
},
}
}
Expand Down Expand Up @@ -181,13 +172,6 @@ impl ColumnBuilder {
self
}

pub fn property(mut self, key: &str, value: &str) -> Self {
self.column
.properties
.insert(key.to_string(), value.to_string());
self
}

pub fn build(self) -> Arc<Column> {
Arc::new(self.column)
}
Expand All @@ -205,7 +189,6 @@ impl RelationshipBuilder {
models: vec![],
join_type: JoinType::OneToOne,
condition: "".to_string(),
properties: BTreeMap::default(),
},
}
}
Expand All @@ -225,13 +208,6 @@ impl RelationshipBuilder {
self
}

pub fn property(mut self, key: &str, value: &str) -> Self {
self.relationship
.properties
.insert(key.to_string(), value.to_string());
self
}

pub fn build(self) -> Arc<Relationship> {
Arc::new(self.relationship)
}
Expand All @@ -252,7 +228,6 @@ impl MetricBuilder {
time_grain: vec![],
cached: false,
refresh_time: None,
properties: BTreeMap::default(),
},
}
}
Expand Down Expand Up @@ -282,13 +257,6 @@ impl MetricBuilder {
self
}

pub fn property(mut self, key: &str, value: &str) -> Self {
self.metric
.properties
.insert(key.to_string(), value.to_string());
self
}

pub fn build(self) -> Arc<Metric> {
Arc::new(self.metric)
}
Expand Down Expand Up @@ -334,7 +302,6 @@ impl ViewBuilder {
view: View {
name: name.to_string(),
statement: "".to_string(),
properties: BTreeMap::default(),
},
}
}
Expand All @@ -344,13 +311,6 @@ impl ViewBuilder {
self
}

pub fn property(mut self, key: &str, value: &str) -> Self {
self.view
.properties
.insert(key.to_string(), value.to_string());
self
}

pub fn build(self) -> Arc<View> {
Arc::new(self.view)
}
Expand All @@ -374,7 +334,6 @@ mod test {
.calculated(true)
.not_null(true)
.expression("test")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&expected).unwrap();
Expand Down Expand Up @@ -430,7 +389,6 @@ mod test {
.primary_key("id")
.cached(true)
.refresh_time("1h")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&model).unwrap();
Expand All @@ -445,7 +403,6 @@ mod test {
.primary_key("id")
.cached(true)
.refresh_time("1h")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&model).unwrap();
Expand All @@ -470,7 +427,6 @@ mod test {
.model("testB")
.join_type(JoinType::OneToMany)
.condition("test")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&expected).unwrap();
Expand Down Expand Up @@ -523,7 +479,6 @@ mod test {
)
.cached(true)
.refresh_time("1h")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&model).unwrap();
Expand All @@ -535,7 +490,6 @@ mod test {
fn test_view_roundtrip() {
let expected = ViewBuilder::new("test")
.statement("SELECT * FROM test")
.property("key", "value")
.build();

let json_str = serde_json::to_string(&expected).unwrap();
Expand All @@ -553,15 +507,13 @@ mod test {
.primary_key("id")
.cached(true)
.refresh_time("1h")
.property("key", "value")
.build();

let relationship = RelationshipBuilder::new("test")
.model("testA")
.model("testB")
.join_type(JoinType::OneToMany)
.condition("test")
.property("key", "value")
.build();

let metric = MetricBuilder::new("test")
Expand All @@ -575,12 +527,10 @@ mod test {
)
.cached(true)
.refresh_time("1h")
.property("key", "value")
.build();

let view = ViewBuilder::new("test")
.statement("SELECT * FROM test")
.property("key", "value")
.build();

let expected = crate::mdl::builder::ManifestBuilder::new()
Expand Down
10 changes: 0 additions & 10 deletions wren-core/core/src/mdl/manifest.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::BTreeMap;
use std::fmt::Display;
use std::sync::Arc;

Expand Down Expand Up @@ -39,8 +38,6 @@ pub struct Model {
pub cached: bool,
#[serde(default)]
pub refresh_time: Option<String>,
#[serde(default)]
pub properties: BTreeMap<String, String>,
}

impl Model {
Expand Down Expand Up @@ -170,8 +167,6 @@ pub struct Column {
#[serde_as(as = "NoneAsEmptyString")]
#[serde(default)]
pub expression: Option<String>,
#[serde(default)]
pub properties: BTreeMap<String, String>,
}

#[derive(Serialize, Deserialize, Debug, Hash, PartialEq, Eq)]
Expand All @@ -181,8 +176,6 @@ pub struct Relationship {
pub models: Vec<String>,
pub join_type: JoinType,
pub condition: String,
#[serde(default)]
pub properties: BTreeMap<String, String>,
}

#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Hash, Clone, Copy)]
Expand Down Expand Up @@ -226,7 +219,6 @@ pub struct Metric {
#[serde(default, with = "bool_from_int")]
pub cached: bool,
pub refresh_time: Option<String>,
pub properties: BTreeMap<String, String>,
}

impl Metric {
Expand Down Expand Up @@ -257,8 +249,6 @@ pub enum TimeUnit {
pub struct View {
pub name: String,
pub statement: String,
#[serde(default)]
pub properties: BTreeMap<String, String>,
}

impl View {
Expand Down

0 comments on commit 4ec91ca

Please sign in to comment.