Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Verify codegen #3680

Closed
wants to merge 118 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
bf5054e
[GLogue] define GlogueMetadataQuery
BingqingLyu Aug 14, 2023
ebd0ac5
[GLogue] define GLogueSchema for GLogue Building
BingqingLyu Aug 14, 2023
96a97bf
[GLogue] build/extend pattern based on Schema
BingqingLyu Aug 14, 2023
54629f7
[GLogue] build GLogue structure based on pattern extend
BingqingLyu Aug 14, 2023
b16e456
[GLogue] update GlogueSchema according to new GraphSchema
BingqingLyu Aug 14, 2023
1b24b69
minor: some refinement
BingqingLyu Aug 14, 2023
ac0bb1e
refine: 1) some field name refactor, 2) no duplicated edge in Glogue
BingqingLyu Aug 16, 2023
d5bd303
[GLogue] add GlogueEdge, to represent extend edges between patterns i…
BingqingLyu Aug 17, 2023
023e377
[Glogue] a naive cardinality estimation
BingqingLyu Aug 21, 2023
251c71d
[GLogue] implment a GraphOrdering, for PatternMapping construction
BingqingLyu Aug 24, 2023
23b0a26
[GLogue] abstract PatternOrder, and give a PatternOrderCanonicalLabel…
BingqingLyu Sep 6, 2023
63453d6
[GLogue] 1. define and implement weight of ExtendEdge and ExtendStep,…
BingqingLyu Sep 11, 2023
879cef7
[Glogue] abstract PatternVertex and PatternEdge, and give implementat…
BingqingLyu Sep 14, 2023
f381544
[GIE Compiler] add start alias in each graph operator
shirly121 Sep 14, 2023
11cce12
[GLogue] enable isomorphic check with user given comparator; and some…
BingqingLyu Sep 19, 2023
a07b977
[GLogue] add FuzzyPatternVertex and FuzzyPatternEdge
BingqingLyu Sep 19, 2023
493edad
minor: fix in ordering implementations
BingqingLyu Sep 25, 2023
42cc18e
wip: fuzzy process
BingqingLyu Oct 12, 2023
23be357
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Oct 13, 2023
80a0e0a
wip
BingqingLyu Oct 16, 2023
544a5f5
[GIE Compiler] integrate glogue into calcite optimizer
shirly121 Oct 16, 2023
5213b0c
minor fix: fix in getOut/InNeighbors in GlogueQuery
BingqingLyu Oct 17, 2023
338374d
Merge remote-tracking branch 'shirly/ir_calcite_glogue' into ir_glogu…
shirly121 Oct 18, 2023
4cde30b
[GIE Compiler] support cost pruning
shirly121 Oct 19, 2023
d42797b
modify low-order statistics in GlogueSchema to break the tie
BingqingLyu Oct 23, 2023
e9b2d34
[GLogueSchema] build GlogueSchema from file, and add statistics file …
BingqingLyu Oct 25, 2023
04f7f2f
Add Logger for GLogue
BingqingLyu Oct 26, 2023
1d53068
[GIE Compiler] support extend transform rules
shirly121 Oct 27, 2023
edfdb52
[GIE Compiler] refine package name
shirly121 Oct 30, 2023
fa39648
[GIE Compiler] minor fix
shirly121 Oct 30, 2023
d60f4da
Merge branch 'main' into ir_glogue_opt
shirly121 Oct 30, 2023
4533a63
[GIE Compiler] implement input processor
shirly121 Oct 31, 2023
24c1057
Merge branch 'ir_fix_graph' into ir_glogue_opt
shirly121 Nov 2, 2023
7681d40
[GIE Compiler] minor fix
shirly121 Nov 3, 2023
ad2fe64
minor fix
shirly121 Nov 3, 2023
55c4c25
fix a bug in GlogueSchema
BingqingLyu Nov 3, 2023
57a851a
[GIE Compiler] fix bugs in count estimation for big pattern graph
shirly121 Nov 6, 2023
c1ed606
[GIE Compiler] add GraphOptimizer
shirly121 Nov 7, 2023
e762fc8
refine some interfaces in glogue
shirly121 Nov 7, 2023
2b41798
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 7, 2023
8785b2c
add log info for each pattern
shirly121 Nov 7, 2023
0e06893
[GIE Optimizer] refine isomorphism impl in glogue
shirly121 Nov 8, 2023
c41eb65
[GIE Optimizer] format java codes
shirly121 Nov 8, 2023
40c080d
add log info for each pattern
shirly121 Nov 7, 2023
a6c76c8
[GIE Optimizer] add BOTH in pattern direction
shirly121 Nov 8, 2023
6591e99
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 8, 2023
3f592d4
[GIE Optimizer] refine interfaces in ExtendEdge
shirly121 Nov 9, 2023
7c495a8
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 9, 2023
e235ea3
[GIE Optimizer] refine interfaces in ExtendEdge
shirly121 Nov 9, 2023
9f5c1c4
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 9, 2023
9b340c1
[GIE Compiler] support pattern with both | fuzzy | filter
shirly121 Nov 9, 2023
fda98e6
[GIE Optimizer] refine interfaces in ExtendEdge
shirly121 Nov 9, 2023
cc6840b
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 9, 2023
6c204ce
[GIE Optimizer] refine interfaces in ExtendEdge
shirly121 Nov 9, 2023
db0f9b6
Merge branch 'ir_calcite_glogue' into ir_glogue_opt
shirly121 Nov 9, 2023
92ad788
[GIE Optimizer] minor fix
shirly121 Nov 9, 2023
21e7b25
[GIE Optimizer] support row count estimation for complex patterns
shirly121 Nov 16, 2023
fe90e08
Merge branch 'ir_glogue_opt' of github.com:shirly121/GraphScope into …
shirly121 Nov 16, 2023
7ad5812
[GIE Optimizer] minor fix
shirly121 Nov 17, 2023
6e8eef5
[GIE Optimizer] remove useless codes
shirly121 Nov 22, 2023
f9676f8
[GIE Optimizer] introduce graph optimizer to graph planner
shirly121 Dec 19, 2023
dd700a9
Merge branch 'main' into ir_glogue_opt
shirly121 Dec 25, 2023
541e4e7
minor: remove some logs
BingqingLyu Dec 27, 2023
3dd9ce8
Merge branch 'ir_glogue_opt' of github.com:shirly121/GraphScope into …
shirly121 Dec 28, 2023
7a84aed
[GIE Opt] impl JoinDecompostionRule for s-t path
shirly121 Jan 9, 2024
d1f2fc4
[GIE Opt] impl PathExpandSplitRule for s-t path
shirly121 Jan 11, 2024
75bdd6a
Merge branch 'main' into ir_glogue_opt
shirly121 Mar 5, 2024
f391dbf
[GIE Compiler] introduce CBO Graph Optimizer
shirly121 Mar 5, 2024
5bace50
Merge branch 'main' into ir_glogue_opt
shirly121 Mar 22, 2024
fb4d8e7
Merge branch 'main' into ir_glogue_opt
shirly121 Mar 25, 2024
28ae0c5
fix codegen error and add some cypher queries
zhanglei1949 Mar 26, 2024
6e51f4e
fix
zhanglei1949 Mar 26, 2024
3e6579f
add ldbc plugin
zhanglei1949 Mar 26, 2024
dae0727
[GIE Compiler] fix optimizer config bug
shirly121 Mar 27, 2024
e9e4eba
merge ir_glogue_opt
zhanglei1949 Mar 27, 2024
9a79303
[GIE Compiler] support optional match in graph optimizer
shirly121 Mar 27, 2024
9b8e168
[bug fix] fix metadata for PathExpand
BingqingLyu Mar 27, 2024
0221cc0
Merge remote-tracking branch 'xiaoli/ir_glogue_opt' into with_glog_opt
zhanglei1949 Mar 27, 2024
7723fb5
[bug fix] fix metadata for PathExpand
BingqingLyu Mar 27, 2024
c0f4095
minor fix
shirly121 Mar 27, 2024
01f7427
fix path expand when range lower bound is 0
shirly121 Mar 13, 2024
cdfc4a8
Merge branch 'ir_glogue_opt' into ir_opt_optional
shirly121 Mar 27, 2024
df9f98a
minor fix: if the expand base is a fused ExpandGetV, then the type is…
BingqingLyu Mar 27, 2024
6b16b4d
Revert "[bug fix] fix metadata for PathExpand"
BingqingLyu Mar 27, 2024
c373454
Merge branch 'ir_glogue_opt' of github.com:shirly121/GraphScope into …
shirly121 Mar 27, 2024
e5606a7
refine some error notices
shirly121 Mar 27, 2024
3aec2f6
Revert "minor fix: if the expand base is a fused ExpandGetV, then the…
BingqingLyu Mar 27, 2024
0202d1f
for fused ExpandGetV, output its metadata as the metadata of EdgeExpand
BingqingLyu Mar 27, 2024
af20046
refine some error notices
shirly121 Mar 27, 2024
d9c4153
Merge branch 'ir_glogue_opt' of github.com:shirly121/GraphScope into …
shirly121 Mar 27, 2024
2e0790d
Merge branch 'main' into ir_glogue_opt
shirly121 Mar 27, 2024
cabf778
refine codes
shirly121 Mar 27, 2024
045d3e3
Merge branch 'ir_glogue_opt' into ir_opt_optional
shirly121 Mar 27, 2024
eb3671b
minor fix
shirly121 Mar 27, 2024
d290458
Revert "minor fix"
shirly121 Mar 27, 2024
cb8e4d3
minor: format
BingqingLyu Mar 27, 2024
d5c984d
minor fix
shirly121 Mar 27, 2024
feb03fc
Merge branch 'ir_glogue_opt' into ir_opt_optional
shirly121 Mar 27, 2024
f8a2b1c
merge
zhanglei1949 Mar 27, 2024
b127e9e
Merge branch 'main' into fix_path_metadata
BingqingLyu Mar 28, 2024
4e4e00c
[GIE Compiler] support intersect in proto converter
BingqingLyu Mar 28, 2024
82ef75a
for the case of ExpandV + Auxilia, give the expected alias in Auxilia
BingqingLyu Mar 28, 2024
f527d0a
minor refine
BingqingLyu Mar 28, 2024
c51eb96
minor fix
shirly121 Mar 28, 2024
510d7c8
Merge remote-tracking branch 'shirly/ir_converter_intersect' into ir_…
shirly121 Mar 28, 2024
a5b1ec0
Merge branch 'ir_opt_optional' into ir_opt_test
shirly121 Mar 28, 2024
34e4a17
minor fix
shirly121 Mar 28, 2024
1c25582
fix ci
BingqingLyu Mar 28, 2024
1a411db
Merge branch 'main' into fix_converter_alias
BingqingLyu Mar 28, 2024
1a774e8
todo: ic12
zhanglei1949 Mar 28, 2024
f0ba697
fix bugs of expand type
shirly121 Mar 28, 2024
6ed6f3d
Merge branch 'ir_opt_optional' into ir_opt_test
shirly121 Mar 28, 2024
47ca879
merge
zhanglei1949 Mar 29, 2024
9350517
Merge remote-tracking branch 'xiaoli/fix_path_metadata' into with_glo…
zhanglei1949 Mar 29, 2024
05f185f
fix merge
zhanglei1949 Mar 29, 2024
05be28f
fix metadata in path_expand
zhanglei1949 Mar 29, 2024
776e0ca
merge fix_alias
zhanglei1949 Mar 29, 2024
44cbe83
todo: fix ic1,10 correct
zhanglei1949 Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .github/workflows/hqps-db-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,14 @@ jobs:
cd ${GITHUB_WORKSPACE}/flex/bin

for i in 1 2 3 4 5 6 7 8 9 10 11 12;
do
cmd="./load_plan_and_gen.sh -e=hqps -i=../resources/queries/ic/adhoc/ic${i}_adhoc.cypher -w=/tmp/codegen/"
cmd=${cmd}" -o=/tmp/plugin --ir_conf=../tests/hqps/engine_config_test.yaml "
cmd=${cmd}" --graph_schema_path=${INTERACTIVE_WORKSPACE}/data/ldbc/graph.yaml"
echo $cmd
eval ${cmd} || exit 1
done
for i in 12;
do
cmd="GLOG_v=10 ./load_plan_and_gen.sh -e=hqps -i=../resources/queries/ic/stored_procedure/ic${i}.cypher -w=/tmp/codegen/"
cmd=${cmd}" -o=/tmp/plugin --ir_conf=../tests/hqps/engine_config_test.yaml "
cmd=${cmd}" --graph_schema_path=${INTERACTIVE_WORKSPACE}/data/ldbc/graph.yaml"
echo $cmd
eval ${cmd}
done

for i in 1 2 3 4 5 6 7 8 9 10 11 12;
do
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,6 @@ flex/interactive/examples/sf0.1-raw/
flex/interactive/.running
flex/interactive/.env

flex/**/*.so

**/.cache/
3 changes: 3 additions & 0 deletions flex/.devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
]
}
},
"mounts": [
"source=/mnt/zhanglei,target=/home/graphscope/data/,type=bind,consistency=cached"
],
// Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "graphscope",
"postCreateCommand": "sudo chown -R graphscope /workspaces && bash pre-commit/install-hook.sh && bash pre-commit/prepare-commit-msg"
Expand Down
8 changes: 8 additions & 0 deletions flex/codegen/gen_code_from_plan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,14 @@ void deserialize_plan_and_gen_hqps(const std::string& input_file_path,
CHECK(plan_pb.ParseFromArray(content_str.data(), content_str.size()));
LOG(INFO) << "deserialized plan size : " << plan_pb.ByteSizeLong();
VLOG(1) << "deserialized plan : " << plan_pb.DebugString();
std::string output_path = output_file_path + ".json";
std::string json_plan;
google::protobuf::util::JsonOptions option;
option.always_print_primitive_fields = true;
google::protobuf::util::MessageToJsonString(plan_pb, &json_plan, option);
std::ofstream out(output_path);
out << json_plan;
out.close();
BuildingContext context;
std::shared_ptr<QueryGenerator<uint8_t>> query_generator;
// load schema
Expand Down
4 changes: 4 additions & 0 deletions flex/codegen/src/codegen_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,16 @@ codegen::ParamConst variable_to_param_const(const common::Variable& var,
auto& var_property = var.property();
if (var_property.has_label()) {
param_const.var_name = "label";
param_const.expr_var_name = "label";
param_const.type = codegen::DataType::kLabelId;
} else if (var_property.has_key()) {
param_const.var_name = var.property().key().name();
param_const.expr_var_name = var.property().key().name();
param_const.type =
common_data_type_pb_2_data_type(var.node_type().data_type());
} else if (var_property.has_id()) {
param_const.var_name = ctx.GetNextVarName();
param_const.expr_var_name = ctx.GetNextVarName();
param_const.type = codegen::DataType::kGlobalVertexId;
} else {
LOG(FATAL) << "Unexpected property type: " << var_property.DebugString();
Expand All @@ -217,6 +220,7 @@ codegen::ParamConst variable_to_param_const(const common::Variable& var,
if (var.has_node_type()) {
auto node_type = var.node_type();
param_const.var_name = ctx.GetNextVarName();
param_const.expr_var_name = param_const.var_name;
if (node_type.type_case() == common::IrDataType::kDataType) {
param_const.type =
common_data_type_pb_2_data_type(node_type.data_type());
Expand Down
12 changes: 9 additions & 3 deletions flex/codegen/src/graph_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ enum class DataType {
struct ParamConst {
DataType type;
std::string var_name;
std::string expr_var_name;
int32_t id; // unique id for each param const
};

// implement operator == for ParamConst
inline bool operator==(const ParamConst& lhs, const ParamConst& rhs) {
return lhs.type == rhs.type && lhs.var_name == rhs.var_name &&
lhs.id == rhs.id;
lhs.expr_var_name == rhs.expr_var_name && lhs.id == rhs.id;
}

} // namespace codegen
Expand Down Expand Up @@ -159,7 +160,7 @@ static codegen::ParamConst param_const_pb_to_param_const(
CHECK(data_type_pb.type_case() == common::IrDataType::kDataType);
return codegen::ParamConst{
common_data_type_pb_2_data_type(data_type_pb.data_type()),
param_const_pb.name(), param_const_pb.index()};
param_const_pb.name(), param_const_pb.name(), param_const_pb.index()};
}

static codegen::ParamConst param_const_pb_to_param_const(
Expand All @@ -168,7 +169,8 @@ static codegen::ParamConst param_const_pb_to_param_const(
if (ir_data_type.type_case() == common::IrDataType::kDataType) {
auto primitive_type = ir_data_type.data_type();
return codegen::ParamConst{common_data_type_pb_2_data_type(primitive_type),
param_const_pb.name(), param_const_pb.index()};
param_const_pb.name(), param_const_pb.name(),
param_const_pb.index()};
} else {
throw std::runtime_error("Expect node type in ir_data_type");
}
Expand Down Expand Up @@ -223,6 +225,8 @@ static std::string decode_type_as_str(const codegen::DataType& data_type) {
return "get_string()";
case codegen::DataType::kBoolean:
return "get_bool()";
case codegen::DataType::kDate:
return "get_long()";
default:
// LOG(FATAL) << "unknown data type" << static_cast<int>(data_type);
throw std::runtime_error("unknown data type when decode type as str: " +
Expand Down Expand Up @@ -279,11 +283,13 @@ static void parse_param_const_from_pb(
if (data_type.type_case() == common::IrDataType::kDataType) {
param_cost.type = common_data_type_pb_2_data_type(data_type.data_type());
param_cost.var_name = param_const_pb.name();
param_cost.expr_var_name = param_const_pb.name();
param_cost.id = param_const_pb.index();
return;
} else if (node_type.type_case() == common::IrDataType::kDataType) {
param_cost.type = common_data_type_pb_2_data_type(node_type.data_type());
param_cost.var_name = param_const_pb.name();
param_cost.expr_var_name = param_const_pb.name();
param_cost.id = param_const_pb.index();
return;
} else {
Expand Down
13 changes: 7 additions & 6 deletions flex/codegen/src/hqps/hqps_edge_expand_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@ static std::pair<std::string, std::string> BuildMultiLabelEdgeExpandOpt(

std::vector<std::vector<int32_t>> edge_label_triplet =
parse_edge_label_triplet_from_ir_data_type(meta_data.type());
CHECK(edge_label_triplet.size() == prop_names.size());
LOG(INFO) << "Find multiple edge triplet: " << edge_label_triplet.size();

auto func_template_str = make_edge_expand_e_func_template_str(prop_types);
auto edge_named_prop_array =
make_prop_tuple_array_tuple(prop_names, prop_types);

if (params.has_predicate()) {
VLOG(10) << "Found expr in edge expand with multiple label triplet";
Expand All @@ -424,6 +418,13 @@ static std::pair<std::string, std::string> BuildMultiLabelEdgeExpandOpt(
boost::format formater;
if (expand_opt ==
physical::EdgeExpand::ExpandOpt::EdgeExpand_ExpandOpt_EDGE) {
// only parse the prop_names if the expand opt is edge.
CHECK(edge_label_triplet.size() == prop_names.size());
LOG(INFO) << "Find multiple edge triplet: " << edge_label_triplet.size();

auto func_template_str = make_edge_expand_e_func_template_str(prop_types);
auto edge_named_prop_array =
make_prop_tuple_array_tuple(prop_names, prop_types);
auto edge_triplet_2d_array =
edge_label_triplet_to_array_str(edge_label_triplet);
if (params.has_predicate()) {
Expand Down
30 changes: 15 additions & 15 deletions flex/codegen/src/hqps/hqps_expr_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ class ExprBuilder {
// and also set a expr node for it. which is unique.
make_var_name_unique(param_const);
func_call_vars_.push_back(param_const);
expr_nodes_.emplace_back(param_const.var_name);
expr_nodes_.emplace_back(param_const.expr_var_name);

// expr_nodes_.emplace_back(param_const.var_name);
// convert a variable to a tag property,
Expand Down Expand Up @@ -389,7 +389,7 @@ class ExprBuilder {
VLOG(10) << "receive param const: " << param_const_pb.DebugString();
make_var_name_unique(param_const);
construct_params_.push_back(param_const);
expr_nodes_.emplace_back(param_const.var_name + "_");
expr_nodes_.emplace_back(param_const.expr_var_name);
break;
}

Expand Down Expand Up @@ -534,7 +534,7 @@ class ExprBuilder {
std::stringstream ss;
for (size_t i = 0; i < construct_params_.size(); ++i) {
ss << data_type_2_string(construct_params_[i].type) << " "
<< construct_params_[i].var_name;
<< construct_params_[i].expr_var_name;
if (i + 1 != construct_params_.size()) {
ss << ",";
}
Expand All @@ -548,8 +548,8 @@ class ExprBuilder {
ss << ":";
}
for (size_t i = 0; i < construct_params_.size(); ++i) {
ss << construct_params_[i].var_name << "_"
<< "(" << construct_params_[i].var_name << ")";
ss << construct_params_[i].expr_var_name << "("
<< construct_params_[i].expr_var_name << ")";
if (i != construct_params_.size() - 1) {
ss << ",";
}
Expand Down Expand Up @@ -578,7 +578,7 @@ class ExprBuilder {
std::stringstream ss;
for (size_t i = 0; i < func_call_vars_.size(); ++i) {
ss << data_type_2_string(func_call_vars_[i].type) << " "
<< func_call_vars_[i].var_name;
<< func_call_vars_[i].expr_var_name;
if (i != func_call_vars_.size() - 1) {
ss << ",";
}
Expand All @@ -600,31 +600,31 @@ class ExprBuilder {
std::stringstream ss;
for (size_t i = 0; i < construct_params_.size(); ++i) {
ss << data_type_2_string(construct_params_[i].type) << " "
<< construct_params_[i].var_name << "_;" << std::endl;
<< construct_params_[i].expr_var_name << ";" << std::endl;
}
return ss.str();
}

void make_var_name_unique(codegen::ParamConst& param_const) {
std::unordered_set<std::string> var_names;
for (auto& param : construct_params_) {
auto res = var_names.insert(param.var_name);
CHECK(res.second) << "var name: " << param.var_name
auto res = var_names.insert(param.expr_var_name);
CHECK(res.second) << "var name: " << param.expr_var_name
<< " already exists, illegal state";
}
for (auto& param : func_call_vars_) {
auto res = var_names.insert(param.var_name);
CHECK(res.second) << "var name: " << param.var_name
auto res = var_names.insert(param.expr_var_name);
CHECK(res.second) << "var name: " << param.expr_var_name
<< " already exists, illegal state";
}
auto cur_var_name = param_const.var_name;
auto cur_var_name = param_const.expr_var_name;
int i = 0;
while (var_names.find(cur_var_name) != var_names.end()) {
cur_var_name = param_const.var_name + "_" + std::to_string(i);
cur_var_name = param_const.expr_var_name + "_" + std::to_string(i);
++i;
}
param_const.var_name = cur_var_name;
VLOG(10) << "make var name unique: " << param_const.var_name;
param_const.expr_var_name = cur_var_name;
VLOG(10) << "make var name unique: " << param_const.expr_var_name;
}

// this corresponding to the input params.
Expand Down
25 changes: 21 additions & 4 deletions flex/codegen/src/hqps/hqps_path_expand_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,20 @@ static std::string BuildPathExpandVOp(

// CHECK(!path_expand_pb.has_alias());
builder.out_tag(out_tag_id); // out_tag_id overrides alias
LOG(INFO) << "path expand op: " << path_expand_pb.DebugString()
<< ", has get_v: "
<< std::to_string(path_expand_pb.base().has_get_v());

physical::GetV get_v_pb;
if (path_expand_pb.base().has_get_v()) {
get_v_pb = path_expand_pb.base().get_v();
} else {
VLOG(10) << "get_v seems fused into edge_expand_base";
get_v_pb.set_opt(physical::GetV_VOpt_OTHER);
}

return builder
.path_expand_opt(path_expand_pb.base().edge_expand(),
path_expand_pb.base().get_v(),
.path_expand_opt(path_expand_pb.base().edge_expand(), get_v_pb,
meta_data) // get_v_opt must be called first to
// provide dst_label ids.
.hop_range(path_expand_pb.hop_range())
Expand Down Expand Up @@ -422,9 +432,16 @@ static std::string BuildPathExpandPathOp(
builder.out_tag(-1);
}

physical::GetV get_v_pb;
if (path_expand_pb.base().has_get_v()) {
get_v_pb = path_expand_pb.base().get_v();
} else {
VLOG(10) << "get_v seems fused into edge_expand_base";
get_v_pb.set_opt(physical::GetV_VOpt_OTHER);
}

return builder
.path_expand_opt(path_expand_pb.base().edge_expand(),
path_expand_pb.base().get_v(),
.path_expand_opt(path_expand_pb.base().edge_expand(), get_v_pb,
meta_data) // get_v_opt must be called first to
// provide dst_label ids.
.hop_range(path_expand_pb.hop_range())
Expand Down
3 changes: 0 additions & 3 deletions flex/codegen/src/hqps/hqps_project_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ std::tuple<std::string, std::string, std::string> concatenate_expr_built_result(
}
{
std::stringstream ss;
if (func_construct_param_const.size() > 0) {
ss << ", ";
}
for (size_t i = 0; i < func_construct_param_const.size(); ++i) {
ss << func_construct_param_const[i].var_name;
if (i != func_construct_param_const.size() - 1) {
Expand Down
16 changes: 12 additions & 4 deletions flex/codegen/src/hqps_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,17 @@ class QueryGenerator {
if (param_vars.size() > 0) {
sort(param_vars.begin(), param_vars.end(),
[](const auto& a, const auto& b) { return a.id < b.id; });
LOG(INFO) << "param vars size: " << param_vars.size();
for (auto& param_var : param_vars) {
LOG(INFO) << "param var: " << param_var.id << " " << param_var.var_name;
}
CHECK(param_vars[0].id == 0);
for (size_t i = 0; i < param_vars.size(); ++i) {
if (i > 0 && param_vars[i].id == param_vars[i - 1].id) {
// found duplicate
CHECK(param_vars[i] == param_vars[i - 1]);
CHECK(param_vars[i].var_name == param_vars[i - 1].var_name)
<< " " << param_vars[i].var_name << " "
<< param_vars[i - 1].var_name;
continue;
} else {
ss << data_type_2_string(param_vars[i].type) << " "
Expand Down Expand Up @@ -290,7 +296,9 @@ class QueryGenerator {

for (size_t i = 0; i < param_vars.size(); ++i) {
if (i > 0 && param_vars[i].id == param_vars[i - 1].id) {
CHECK(param_vars[i] == param_vars[i - 1]);
CHECK(param_vars[i].var_name == param_vars[i - 1].var_name)
<< " " << i << " " << param_vars[i].var_name << " "
<< param_vars[i - 1].var_name;
continue;
} else {
auto& cur_param_var = param_vars[i];
Expand Down Expand Up @@ -438,7 +446,7 @@ class QueryGenerator {

case physical::PhysicalOpr::Operator::kVertex: {
physical::PhysicalOpr::MetaData meta_data;
LOG(INFO) << "Found a get v operator";
LOG(INFO) << "Found a get v operator: " << opr.vertex().DebugString();
auto& get_v_op = opr.vertex();
auto get_v_code = BuildGetVOp<LabelT>(ctx_, get_v_op, meta_data);
// first output code can be empty, just ignore
Expand Down Expand Up @@ -468,7 +476,6 @@ class QueryGenerator {
// Path Expand + GetV shall be always fused.
case physical::PhysicalOpr::Operator::kPath: {
physical::PhysicalOpr::MetaData meta_data;
LOG(INFO) << "Found a path operator";
auto& path_op = opr.path();
if (FUSE_PATH_EXPAND_V && !path_op.has_alias() && (i + 1 < size)) {
auto& next_op = plan_.plan(i + 1).opr();
Expand All @@ -489,6 +496,7 @@ class QueryGenerator {
}
}
LOG(INFO) << " PathExpand to Path";
LOG(INFO) << "PathExpand: " << path_op.DebugString();
// otherwise, just expand path
auto res = BuildPathExpandPathOp<LabelT>(ctx_, path_op, meta_datas);
ss << res;
Expand Down
4 changes: 3 additions & 1 deletion flex/codegen/src/pb_parser/ir_data_type_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ std::vector<std::vector<int32_t>> parse_edge_label_triplet_from_ir_data_type(
auto ele = graph_ele_type.element_opt();
if (ele == common::GraphDataType::GraphElementOpt::
GraphDataType_GraphElementOpt_VERTEX) {
LOG(ERROR) << "Vertex element does not have edge label triplet.";
// We construct edge triplet from source label, destination label and edge
// label

return edge_label_triplets;
} else {
VLOG(10) << "Get edge label triplet: ";
Expand Down
3 changes: 2 additions & 1 deletion flex/codegen/src/pegasus_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class PegasusGenerator {
std::string plan_json;
google::protobuf::util::JsonPrintOptions option;
option.always_print_primitive_fields = true;
auto st = google::protobuf::util::MessageToJsonString(plan_, &plan_json, option);
auto st =
google::protobuf::util::MessageToJsonString(plan_, &plan_json, option);
for (auto i = 0; i < size; ++i) {
auto op = plan_.plan(i);
LOG(INFO) << "Start codegen for operator " << i;
Expand Down
2 changes: 1 addition & 1 deletion flex/engines/graph_db/grin/src/property/property.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void grin_destroy_vertex_property(GRIN_GRAPH g, GRIN_VERTEX_PROPERTY vp) {}
*/
GRIN_DATATYPE grin_get_vertex_property_datatype(GRIN_GRAPH g,
GRIN_VERTEX_PROPERTY vp) {
return (GRIN_DATATYPE)(vp >> 16);
return (GRIN_DATATYPE) (vp >> 16);
}

int grin_get_vertex_property_value_of_int32(GRIN_GRAPH g, GRIN_VERTEX v,
Expand Down
2 changes: 1 addition & 1 deletion flex/engines/hqps_db/core/base_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ class BaseEngine {
auto x_ele = iter.GetAllElement();
auto pair = std::make_pair(std::get<real_x_ind0>(x_ele),
std::get<real_x_ind1>(x_ele));
LOG(INFO) << "pair: " << pair.first << ", " << pair.second;
// LOG(INFO) << "pair: " << pair.first << ", " << pair.second;
if (cur_ind != 0) {
if (prev_tuple == pair && prev_res) {
LOG(INFO) << gs::to_string(prev_tuple)
Expand Down
Loading