Skip to content

Commit

Permalink
Fix deprecation warnings wrt to pregel generated procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
IoannisPanagiotas committed Jan 29, 2024
1 parent f04d224 commit d6ff79b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,16 @@ MethodSpec procMethod(GDSMode gdsMode) {
.addMember("value", "$S", "configuration")
.addMember("defaultValue", "$S", "{}")
.build())
.build())
.addStatement("var specification = new $T()", typeNames.specification(gdsMode))
.build());

if (deprecatedBy.isPresent()) {
methodBuilder.addStatement(
"executionContext().metricsFacade().deprecatedProcedures().called($S)",
fullProcedureName
);
}

methodBuilder.addStatement("var specification = new $T()", typeNames.specification(gdsMode))
.addStatement("var executor = new $T<>(specification, executionContext())", ProcedureExecutor.class)
.addStatement("return executor.compute(graphName, configuration)");
return methodBuilder.build();
Expand Down Expand Up @@ -186,8 +194,16 @@ MethodSpec procEstimateMethod(GDSMode gdsMode) {
.addAnnotation(AnnotationSpec.builder(Description.class)
.addMember("value", "$T.ESTIMATE_DESCRIPTION", BaseProc.class)
.build()
)
.addStatement("var specification = new $T()", typeNames.specification(gdsMode))
);

if (deprecatedBy.isPresent()) {
methodBuilder.addStatement(
"executionContext().metricsFacade().deprecatedProcedures().called($S)",
fullProcedureName
);
}

methodBuilder.addStatement("var specification = new $T()", typeNames.specification(gdsMode))
.addStatement("var executor = new $T<>(specification, executionContext(), transactionContext())", MemoryEstimationExecutor.class)
.addStatement("return executor.computeEstimate(graphNameOrConfiguration, algoConfiguration)");
return methodBuilder.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void shouldMarkAsDeprecated() {
"public java.util.stream.Stream<org.neo4j.gds.pregel.proc.PregelMutateResult> mutate(" + NL +
" @org.neo4j.procedure.Name(\"graphName\") java.lang.String graphName," + NL +
" @org.neo4j.procedure.Name(value = \"configuration\", defaultValue = \"{}\") java.util.Map<java.lang.String, java.lang.Object> configuration) {" + NL +
" executionContext().metricsFacade().deprecatedProcedures().called(\"gds.alpha.bar.mutate\");" + NL +
" var specification = new gds.bar.BarMutateSpecification();" + NL +
" var executor = new org.neo4j.gds.executor.ProcedureExecutor<>(specification, executionContext());" + NL +
" return executor.compute(graphName, configuration);" + NL +
Expand All @@ -145,6 +146,7 @@ void shouldMarkAsDeprecated() {
"public java.util.stream.Stream<org.neo4j.gds.results.MemoryEstimateResult> estimate(" + NL +
" @org.neo4j.procedure.Name(\"graphNameOrConfiguration\") java.lang.Object graphNameOrConfiguration," + NL +
" @org.neo4j.procedure.Name(\"algoConfiguration\") java.util.Map<java.lang.String, java.lang.Object> algoConfiguration) {" + NL +
" executionContext().metricsFacade().deprecatedProcedures().called(\"gds.alpha.bar.mutate.estimate\");" + NL +
" var specification = new gds.bar.BarMutateSpecification();" + NL +
" var executor = new org.neo4j.gds.executor.MemoryEstimationExecutor<>(specification, executionContext(), transactionContext());" + NL +
" return executor.computeEstimate(graphNameOrConfiguration, algoConfiguration);" + NL +
Expand Down

0 comments on commit d6ff79b

Please sign in to comment.