Skip to content

Commit

Permalink
fix ci, and format
Browse files Browse the repository at this point in the history
  • Loading branch information
BingqingLyu committed Sep 18, 2024
1 parent 7771445 commit ea409b3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static QueryContext get_simple_match_query_17_test() {
+ " COMMENT)\n"
+ "OPTIONAL MATCH (message: POST | COMMENT)<-[like:LIKES]-(liker:PERSON)\n"
+ " Return count(person);";
List<String> expected = Arrays.asList("Record<{$f0: 111}>");
List<String> expected = Arrays.asList("Record<{$f0: 851}>");
return new QueryContext(query, expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl GraphPath {
let entry = entry.into();
let id = entry.id();
GraphPath::SimpleEndV((entry, vec![id], 1))
},
}
pb::path_expand::PathOpt::Trail => GraphPath::TrailAllPath(vec![entry.into()]),
},
pb::path_expand::ResultOpt::AllV | pb::path_expand::ResultOpt::AllVE => match path_opt {
Expand Down Expand Up @@ -167,21 +167,27 @@ impl GraphPath {

pub fn get_path_start(&self) -> Option<&VertexOrEdge> {
match self {
GraphPath::AllPath(ref p) | GraphPath::SimpleAllPath(ref p) | GraphPath::TrailAllPath(ref p) => p.first(),
GraphPath::AllPath(ref p)
| GraphPath::SimpleAllPath(ref p)
| GraphPath::TrailAllPath(ref p) => p.first(),
GraphPath::EndV(_) | GraphPath::SimpleEndV(_) => None,
}
}

pub fn get_path_end(&self) -> &VertexOrEdge {
match self {
GraphPath::AllPath(ref p) | GraphPath::SimpleAllPath(ref p) | GraphPath::TrailAllPath(ref p) => p.last().unwrap(),
GraphPath::AllPath(ref p)
| GraphPath::SimpleAllPath(ref p)
| GraphPath::TrailAllPath(ref p) => p.last().unwrap(),
GraphPath::EndV((ref e, _)) | GraphPath::SimpleEndV((ref e, _, _)) => e,
}
}

pub fn get_path_end_mut(&mut self) -> &mut VertexOrEdge {
match self {
GraphPath::AllPath(ref mut p) | GraphPath::SimpleAllPath(ref mut p) | GraphPath::TrailAllPath(ref mut p) => p.last_mut().unwrap(),
GraphPath::AllPath(ref mut p)
| GraphPath::SimpleAllPath(ref mut p)
| GraphPath::TrailAllPath(ref mut p) => p.last_mut().unwrap(),
GraphPath::EndV((ref mut e, _)) | GraphPath::SimpleEndV((ref mut e, _, _)) => e,
}
}
Expand Down Expand Up @@ -233,15 +239,19 @@ impl GraphPath {
// pop the last element from the path, and return the element.
pub fn pop(&mut self) -> Option<VertexOrEdge> {
match self {
GraphPath::AllPath(ref mut p) | GraphPath::SimpleAllPath(ref mut p) | GraphPath::TrailAllPath(ref mut p) => p.pop(),
GraphPath::AllPath(ref mut p)
| GraphPath::SimpleAllPath(ref mut p)
| GraphPath::TrailAllPath(ref mut p) => p.pop(),
GraphPath::EndV(_) | GraphPath::SimpleEndV(_) => None,
}
}

// reverse the path.
pub fn reverse(&mut self) {
match self {
GraphPath::AllPath(ref mut p) | GraphPath::SimpleAllPath(ref mut p) | GraphPath::TrailAllPath(ref mut p) => {
GraphPath::AllPath(ref mut p)
| GraphPath::SimpleAllPath(ref mut p)
| GraphPath::TrailAllPath(ref mut p) => {
p.reverse();
}
GraphPath::EndV(_) | GraphPath::SimpleEndV(_) => {}
Expand All @@ -251,15 +261,19 @@ impl GraphPath {
// get the element ids in the path, including both vertices and edges.
pub fn get_elem_ids(&self) -> Vec<ID> {
match self {
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => p.iter().map(|e| e.id()).collect(),
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => {
p.iter().map(|e| e.id()).collect()
}
GraphPath::EndV((e, _)) | GraphPath::SimpleEndV((e, _, _)) => vec![e.id()],
}
}

// get the element labels in the path, including both vertices and edges.
pub fn get_elem_labels(&self) -> Vec<Option<LabelId>> {
match self {
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => p.iter().map(|e| e.label()).collect(),
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => {
p.iter().map(|e| e.label()).collect()
}
GraphPath::EndV((e, _)) | GraphPath::SimpleEndV((e, _, _)) => vec![e.label()],
}
}
Expand Down Expand Up @@ -409,10 +423,10 @@ impl PartialEq for GraphPath {
| (GraphPath::AllPath(p1), GraphPath::SimpleAllPath(p2))
| (GraphPath::AllPath(p1), GraphPath::TrailAllPath(p2))
| (GraphPath::SimpleAllPath(p1), GraphPath::AllPath(p2))
| (GraphPath::SimpleAllPath(p1), GraphPath::SimpleAllPath(p2))
| (GraphPath::SimpleAllPath(p1), GraphPath::TrailAllPath(p2))
| (GraphPath::TrailAllPath(p1), GraphPath::AllPath(p2))
| (GraphPath::TrailAllPath(p1), GraphPath::SimpleAllPath(p2))
| (GraphPath::SimpleAllPath(p1), GraphPath::SimpleAllPath(p2))
| (GraphPath::SimpleAllPath(p1), GraphPath::TrailAllPath(p2))
| (GraphPath::TrailAllPath(p1), GraphPath::AllPath(p2))
| (GraphPath::TrailAllPath(p1), GraphPath::SimpleAllPath(p2))
| (GraphPath::TrailAllPath(p1), GraphPath::TrailAllPath(p2)) => p1.eq(p2),
(GraphPath::EndV((p1, _)), GraphPath::EndV((p2, _)))
| (GraphPath::EndV((p1, _)), GraphPath::SimpleEndV((p2, _, _)))
Expand Down Expand Up @@ -571,7 +585,9 @@ impl TryFrom<result_pb::GraphPath> for GraphPath {
impl Hash for GraphPath {
fn hash<H: Hasher>(&self, state: &mut H) {
match self {
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => p.hash(state),
GraphPath::AllPath(p) | GraphPath::SimpleAllPath(p) | GraphPath::TrailAllPath(p) => {
p.hash(state)
}
GraphPath::EndV((e, _)) | GraphPath::SimpleEndV((e, _, _)) => e.hash(state),
}
}
Expand Down
4 changes: 3 additions & 1 deletion interactive_engine/executor/ir/runtime/src/assembly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,9 @@ impl<P: PartitionInfo, C: ClusterInfo> IRJobAssembly<P, C> {
base
)))
})?;
if (pb::path_expand::ResultOpt::AllVE == unsafe { std::mem::transmute(path.result_opt) } || pb::path_expand::PathOpt::Trail == unsafe { std::mem::transmute(path.path_opt) })
if (pb::path_expand::ResultOpt::AllVE
== unsafe { std::mem::transmute(path.result_opt) }
|| pb::path_expand::PathOpt::Trail == unsafe { std::mem::transmute(path.path_opt) })
&& pb::edge_expand::ExpandOpt::Vertex
== unsafe { std::mem::transmute(edge_expand.expand_opt) }
{
Expand Down

0 comments on commit ea409b3

Please sign in to comment.