Skip to content

Commit

Permalink
[Bug fix - Gaia-IR] The plan of pattern matching faces a multi-join e…
Browse files Browse the repository at this point in the history
…rror (#1704)

* [dyn_type] Change the dependency from pegasus to pegasus_common to avoid potential cyclice dependencies while using the library in pegasus.

* [IR Runtime] use KeyId for all tags in Runtime, and map tag_id back to tag_name in sink op

* [IR Core] pass tag id_name_mappings to Runtime in SinkOp

* [CI Test] fix all tag related ci tests

* [CI Test] enable ci tests of gaia running on ubuntu20.04

* [CI Test] enable ci tests of gaia running on ubuntu-20.04

* [IR Runtime] support EdgeExpandIntersectionOperator in Runtime

* [IR Runtime] support UnfoldOperator in Runtime

* [CI Test] add ut for edge expand with intersection

* [IR Proto] update proto of Union

* [IR Core] translate union_opr of intersection into physical plan

* [IR Core] consider repartition and auxilia in union_opr of intersection

* refine the codes

* [IR Runtime] start_v in edge_expand of intersection cannot be None

* minor refine

* refine the codes

* [IR Core] Define an Intersect Operator individually as an algebra op

* refine codes

* refine expand_intersect

* refine expand_intersect

* [IR Runtime] refine errors

* [IR runtime] Refine in unfold operator

* refine codes

* [IR Runtime] refine in expand_intersect and more ci tests

* [IR Runtime] refine in unfold

* minor refine

* [Gaia/IR] Reimplement the function of doing intersection.

* [Gaia/IR] Allow duplication in `probing` array.

* Revert "[IR Runtime] Support EdgeExpandWithIntersection and Unfold Op in Runtime"

* Revert "[IR Core] Support Union of Intersection in IR-Core"

* [Data Loading Test] update endpoint of MaxNode

* [Gaia/IR] Fix a bug of processing multi-branch join in pattern matching.

* [IR Compiler] update expected results of unit tests with changes of ir_core logic plan

* [IR Compiler] minor fix

Co-authored-by: BingqingLyu <lv_bingqing@163.com>
Co-authored-by: shirly121 <zxlmillie@163.com>
  • Loading branch information
3 people committed Jun 10, 2022
1 parent 66a4f06 commit 0b49a06
Show file tree
Hide file tree
Showing 36 changed files with 339 additions and 38 deletions.
5 changes: 5 additions & 0 deletions research/query_service/ir/common/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ fn codegen_inplace() -> Result<(), Box<dyn std::error::Error>> {

#[cfg(not(feature = "proto_inplace"))]
fn codegen_inplace() -> Result<(), Box<dyn std::error::Error>> {
println!("cargo:rerun-if-changed=../proto/common.proto");
println!("cargo:rerun-if-changed=../proto/expr.proto");
println!("cargo:rerun-if-changed=../proto/algebra.proto");
println!("cargo:rerun-if-changed=../proto/schema.proto");
println!("cargo:rerun-if-changed=../proto/results.proto");
prost_build::Config::new()
.type_attribute(".", "#[derive(Serialize,Deserialize)]")
.compile_protos(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
},
"children": []
}
],
"roots": [
0
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@
},
"children": []
}
],
"roots": [
0
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
},
"children": []
}
],
"roots": [
0
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@
},
"children": []
}
],
"roots": [
0
]
}
4 changes: 1 addition & 3 deletions research/query_service/ir/core/src/plan/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,7 @@ mod params {
if val.is_err() {
return val.err().unwrap();
}
params
.extra
.insert(key.unwrap(), val.unwrap());
params.extra.insert(key.unwrap(), val.unwrap());
std::mem::forget(params);

FfiError::success()
Expand Down
12 changes: 8 additions & 4 deletions research/query_service/ir/core/src/plan/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,15 @@ impl TryFrom<pb::LogicalPlan> for LogicalPlan {
impl From<LogicalPlan> for pb::LogicalPlan {
fn from(plan: LogicalPlan) -> Self {
let mut id_map: HashMap<u32, i32> = HashMap::with_capacity(plan.len());
let mut roots = vec![];
// As there might be some nodes being removed, we gonna remap the nodes' ids
for (id, node) in plan.nodes.iter().enumerate() {
id_map.insert(node.0 as u32, id as i32);
for (new_id, (old_id, node)) in plan.nodes.iter().enumerate() {
id_map.insert(old_id as u32, new_id as i32);
if node.borrow().parents.is_empty() {
roots.push(new_id as i32);
}
}
let mut plan_pb = pb::LogicalPlan { nodes: vec![] };
let mut plan_pb = pb::LogicalPlan { nodes: vec![], roots };
for (_, node) in &plan.nodes {
let mut node_pb = pb::logical_plan::Node { opr: None, children: vec![] };
let mut operator = node.borrow().opr.clone();
Expand Down Expand Up @@ -1432,7 +1436,7 @@ mod test {
let root_pb = pb::logical_plan::Node { opr: Some(opr.clone()), children: vec![1, 2] };
let node1_pb = pb::logical_plan::Node { opr: Some(opr.clone()), children: vec![2] };
let node2_pb = pb::logical_plan::Node { opr: Some(opr.clone()), children: vec![] };
let plan_pb = pb::LogicalPlan { nodes: vec![root_pb, node1_pb, node2_pb] };
let plan_pb = pb::LogicalPlan { nodes: vec![root_pb, node1_pb, node2_pb], roots: vec![0] };

let plan = LogicalPlan::try_from(plan_pb).unwrap();
assert_eq!(plan.len(), 3);
Expand Down
Loading

0 comments on commit 0b49a06

Please sign in to comment.