Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
ngrislain committed Oct 28, 2023
1 parent b04e812 commit cdbcf1f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.4] - 2023-10-27
### Fixed
- changed PEP compilation

## [0.4.3] - 2023-10-27
### Fixed
- added rewrite_as_pep [MR169](https://github.com/Qrlew/qrlew/pull/169)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["Nicolas Grislain <ng@sarus.tech>"]
name = "qrlew"
version = "0.4.3"
version = "0.4.4"
edition = "2021"
description = "Sarus Qrlew Engine"
documentation = "https://docs.rs/qrlew"
Expand Down
12 changes: 10 additions & 2 deletions src/rewriting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ impl Relation {
pub fn rewrite_as_protected_entity_preserving<'a>(
&'a self,
relations: &'a Hierarchy<Arc<Relation>>,
synthetic_data: SyntheticData,
protected_entity: ProtectedEntity,
budget: Budget,
) -> Result<RelationWithPrivateQuery> {
let budget = Budget::new(1., 1e-5);// TODO Have specific rewriter
let synthetic_data = SyntheticData::new(relations.iter().map(|(path, _)| (path, Identifier::from(path.clone()))).collect());
let relation_with_rules = self.set_rewriting_rules(BaseRewritingRulesSetter::new(
synthetic_data,
protected_entity,
Expand Down Expand Up @@ -216,6 +216,11 @@ mod tests {
let database = postgresql::test_database();
let relations = database.relations();
let query = parse("SELECT order_id, price FROM item_table").unwrap();
let synthetic_data = SyntheticData::new(Hierarchy::from([
(vec!["item_table"], Identifier::from("item_table")),
(vec!["order_table"], Identifier::from("order_table")),
(vec!["user_table"], Identifier::from("user_table")),
]));
let protected_entity = ProtectedEntity::from(vec![
(
"item_table",
Expand All @@ -228,10 +233,13 @@ mod tests {
("order_table", vec![("user_id", "user_table", "id")], "name"),
("user_table", vec![], "name"),
]);
let budget = Budget::new(1., 1e-3);
let relation = Relation::try_from(query.with(&relations)).unwrap();
let relation_with_private_query = relation.rewrite_as_protected_entity_preserving(
&relations,
synthetic_data,
protected_entity,
budget,
).unwrap();
relation_with_private_query
.relation()
Expand Down

0 comments on commit cdbcf1f

Please sign in to comment.