Skip to content

Commit

Permalink
[Proto] refine proto by adding a is_count_only flag in SCAN, and fix …
Browse files Browse the repository at this point in the history
…ci tests
  • Loading branch information
BingqingLyu committed Sep 21, 2023
1 parent 76fbbae commit 858b6d5
Show file tree
Hide file tree
Showing 21 changed files with 179 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ mod test {
alias: None,
params: None,
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
let sink_pb = algebra_pb::Sink { tags: vec![], sink_target: None };
Expand All @@ -587,6 +588,7 @@ mod test {
alias: None,
params: None,
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
let scan2_pb = scan1_pb.clone();
Expand Down
1 change: 1 addition & 0 deletions interactive_engine/executor/ir/common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ impl From<pb::Scan> for physical_pb::Scan {
alias: scan.alias.map(|tag| tag.try_into().unwrap()),
params: scan.params,
idx_predicate: scan.idx_predicate,
is_count_only: scan.is_count_only,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions interactive_engine/executor/ir/core/src/glogue/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ fn generate_source_operator(
alias: Some((source_vertex_id as KeyId).into()),
params: Some(source_vertex_param),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
Ok(source_scan.into())
Expand Down
1 change: 1 addition & 0 deletions interactive_engine/executor/ir/core/src/plan/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,7 @@ mod scan {
extra: HashMap::new(),
}),
idx_predicate: None,
is_count_only: false,
meta_data: None,
});
Box::into_raw(scan) as *const c_void
Expand Down
24 changes: 21 additions & 3 deletions interactive_engine/executor/ir/core/src/plan/logical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ use std::fmt;
use std::iter::FromIterator;
use std::rc::Rc;

use fraction::Fraction;
use ir_common::error::ParsePbError;
use ir_common::generated::algebra as pb;
use ir_common::generated::algebra::pattern::binder::Item;
use ir_common::generated::common as common_pb;
use ir_common::{KeyId, LabelId, NameOrId};

use fraction::Fraction;
use vec_map::VecMap;

use crate::error::{IrError, IrResult};
Expand Down Expand Up @@ -1580,7 +1579,7 @@ impl AsLogical for pb::Unfold {
let curr_node = plan_meta.get_curr_node();
let tag_id = get_or_set_tag_id(tag, plan_meta)?;
// plan_meta.set_tag_nodes(tag_id, plan_meta.get_curr_referred_nodes().to_vec());

let tag_nodes = plan_meta.get_tag_nodes(tag_id).to_vec();
plan_meta.refer_to_nodes(curr_node, tag_nodes.clone());
}
Expand Down Expand Up @@ -2073,6 +2072,7 @@ mod test {
extra: HashMap::new(),
}),
idx_predicate: Some(vec!["software".to_string()].into()),
is_count_only: false,
meta_data: None,
};
scan.preprocess(&meta, &mut plan_meta).unwrap();
Expand Down Expand Up @@ -2152,6 +2152,7 @@ mod test {
extra: HashMap::new(),
}),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2198,6 +2199,7 @@ mod test {
extra: HashMap::new(),
}),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2230,6 +2232,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2285,6 +2288,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2362,6 +2366,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2483,6 +2488,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
let mut opr_id = plan
Expand Down Expand Up @@ -2621,6 +2627,7 @@ mod test {
extra: Default::default(),
}),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2649,6 +2656,7 @@ mod test {
extra: Default::default(),
}),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2686,6 +2694,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2763,6 +2772,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2826,6 +2836,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2884,6 +2895,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2931,6 +2943,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -2990,6 +3003,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -3081,6 +3095,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -3127,6 +3142,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
plan.append_operator_as_node(scan.into(), vec![0])
Expand Down Expand Up @@ -3223,6 +3239,7 @@ mod test {
alias: Some("v".into()),
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -3302,6 +3319,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down
14 changes: 14 additions & 0 deletions interactive_engine/executor/ir/core/src/plan/physical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,6 +1129,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], columns)),
idx_predicate: None,
is_count_only: false,
meta_data: None,
}
}
Expand Down Expand Up @@ -1636,6 +1637,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
let select_opr = pb::Select { predicate: str_to_expr_pb("@.id == 10".to_string()).ok() };
Expand Down Expand Up @@ -1692,6 +1694,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -1730,6 +1733,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -1793,6 +1797,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -1882,6 +1887,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -1994,6 +2000,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2026,6 +2033,7 @@ mod test {
alias: Some(0.into()),
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2115,6 +2123,7 @@ mod test {
alias: Some(0.into()),
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2180,6 +2189,7 @@ mod test {
alias: Some(0.into()),
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2250,6 +2260,7 @@ mod test {
alias: None,
params: Some(query_params(vec![], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};
let expand_opr = pb::EdgeExpand {
Expand Down Expand Up @@ -2309,6 +2320,7 @@ mod test {
alias: Some(0.into()),
params: None,
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -2426,6 +2438,7 @@ mod test {
alias: Some(0.into()),
params: None,
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down Expand Up @@ -3058,6 +3071,7 @@ mod test {
alias: None,
params: Some(query_params(vec!["person".into()], vec![])),
idx_predicate: None,
is_count_only: false,
meta_data: None,
};

Expand Down
Loading

0 comments on commit 858b6d5

Please sign in to comment.