File tree Expand file tree Collapse file tree 4 files changed +12
-2
lines changed
core/src/main/java/org/neo4j/graphalgo/config
common/src/main/java/org/neo4j/graphalgo
test/src/main/java/org/neo4j/graphalgo Expand file tree Collapse file tree 4 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ public interface AlgoBaseConfig extends BaseConfig {
3939 List <String > ALL_NODE_LABELS = Collections .singletonList (ALL_NODES .name ());
4040 List <NodeLabel > ALL_NODE_LABEL_IDENTIFIERS = Collections .singletonList (ALL_NODES );
4141 List <RelationshipType > ALL_RELATIONSHIP_TYPE_IDENTIFIERS = Collections .singletonList (ALL_RELATIONSHIPS );
42+ String CONCURRENCY_KEY = "concurrency" ;
4243
4344 @ Value .Default
4445 default int concurrency () {
Original file line number Diff line number Diff line change 3737public interface GraphCreateConfig extends BaseConfig {
3838
3939 String IMPLICIT_GRAPH_NAME = "" ;
40+ String READ_CONCURRENCY_KEY = "readConcurrency" ;
4041
4142 @ Configuration .Parameter
4243 String graphName ();
Original file line number Diff line number Diff line change 6363import java .util .stream .Stream ;
6464
6565import static org .neo4j .graphalgo .NodeLabel .ALL_NODES ;
66+ import static org .neo4j .graphalgo .config .AlgoBaseConfig .CONCURRENCY_KEY ;
67+ import static org .neo4j .graphalgo .config .AlgoBaseConfig .DEFAULT_CONCURRENCY ;
6668import static org .neo4j .graphalgo .config .BaseConfig .SUDO_KEY ;
69+ import static org .neo4j .graphalgo .config .GraphCreateConfig .READ_CONCURRENCY_KEY ;
6770
6871public abstract class AlgoBaseProc <
6972 ALGO extends Algorithm <ALGO , ALGO_RESULT >,
@@ -86,8 +89,10 @@ protected abstract CONFIG newConfig(
8689 public final CONFIG newConfig (Optional <String > graphName , CypherMapWrapper config ) {
8790 Optional <GraphCreateConfig > maybeImplicitCreate = Optional .empty ();
8891 Collection <String > allowedKeys = new HashSet <>();
92+ // implicit loading
8993 if (!graphName .isPresent ()) {
90- // we should do implicit loading
94+ // inherit concurrency from AlgoBaseConfig
95+ config = config .withNumber (READ_CONCURRENCY_KEY , config .getInt (CONCURRENCY_KEY , DEFAULT_CONCURRENCY ));
9196 GraphCreateConfig createConfig = GraphCreateConfig .createImplicit (getUsername (), config );
9297 maybeImplicitCreate = Optional .of (createConfig );
9398 allowedKeys .addAll (createConfig .configKeys ());
Original file line number Diff line number Diff line change @@ -159,9 +159,11 @@ default void testImplicitGraphCreateFromStoreConfig() {
159159
160160 @ Test
161161 default void testImplicitGraphCreateFromCypherConfig () {
162+ long concurrency = 2 ;
162163 Map <String , Object > tempConfig = MapUtil .map (
163164 NODE_QUERY_KEY , ALL_NODES_QUERY ,
164- RELATIONSHIP_QUERY_KEY , ALL_RELATIONSHIPS_QUERY
165+ RELATIONSHIP_QUERY_KEY , ALL_RELATIONSHIPS_QUERY ,
166+ "concurrency" , concurrency
165167 );
166168 CypherMapWrapper wrapper = createMinimalConfig (CypherMapWrapper .create (tempConfig ));
167169
@@ -182,6 +184,7 @@ default void testImplicitGraphCreateFromCypherConfig() {
182184 assertEquals (ALL_RELATIONSHIPS_QUERY , actualConfig .relationshipQuery ());
183185 assertEquals (IMPLICIT_GRAPH_NAME , actualConfig .graphName ());
184186 assertEquals (TEST_USERNAME , actualConfig .username ());
187+ assertEquals (concurrency , actualConfig .readConcurrency ());
185188 });
186189 }
187190
You can’t perform that action at this time.
0 commit comments