Skip to content

Commit 7d5f62f

Browse files
committed
Validate concurrency in GraphStreamRelationshipsConfig
1 parent e1241ff commit 7d5f62f

File tree

3 files changed

+43
-9
lines changed

3 files changed

+43
-9
lines changed

core/src/main/java/org/neo4j/gds/config/GraphStreamRelationshipsConfig.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.neo4j.gds.ElementProjection;
2424
import org.neo4j.gds.RelationshipType;
2525
import org.neo4j.gds.annotation.Configuration;
26-
import org.neo4j.gds.annotation.ValueClass;
2726
import org.neo4j.gds.api.GraphStore;
2827
import org.neo4j.gds.core.CypherMapWrapper;
2928

@@ -36,9 +35,8 @@
3635

3736
import static org.neo4j.gds.utils.StringFormatting.formatWithLocale;
3837

39-
@ValueClass
4038
@Configuration
41-
public interface GraphStreamRelationshipsConfig extends BaseConfig {
39+
public interface GraphStreamRelationshipsConfig extends BaseConfig, ConcurrencyConfig {
4240

4341
@Configuration.Parameter
4442
Optional<String> graphName();
@@ -49,11 +47,6 @@ default List<String> relationshipTypes() {
4947
return Collections.singletonList(ElementProjection.PROJECT_ALL);
5048
}
5149

52-
@Value.Default
53-
default int concurrency() {
54-
return ConcurrencyConfig.DEFAULT_CONCURRENCY;
55-
}
56-
5750
@Configuration.Ignore
5851
default Collection<RelationshipType> relationshipTypeIdentifiers(GraphStore graphStore) {
5952
return relationshipTypes().contains(ElementProjection.PROJECT_ALL)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
package org.neo4j.gds.config;
21+
22+
import org.junit.jupiter.api.Test;
23+
24+
import java.util.List;
25+
import java.util.Optional;
26+
27+
import static org.assertj.core.api.Assertions.assertThatThrownBy;
28+
29+
class GraphStreamRelationshipsConfigTest {
30+
31+
@Test
32+
void validateConcurrency() {
33+
var builder = GraphStreamRelationshipsConfigImpl.builder()
34+
.graphName(Optional.of("g"))
35+
.relationshipTypes(List.of("*"))
36+
.concurrency(42);
37+
38+
assertThatThrownBy(builder::build).hasMessageContaining("Community users cannot exceed concurrency");
39+
}
40+
41+
}

proc/catalog/src/test/java/org/neo4j/gds/catalog/GraphStreamRelationshipsProcTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void shouldStreamInParallel() {
133133
runQuery("CALL gds.beta.graph.generate('generatedGraph', 10000, 5)");
134134

135135
var actualRelationships = new ArrayList<TopologyResult>();
136-
runQueryWithRowConsumer("CALL gds.beta.graph.relationships.stream('generatedGraph', ['*'], { concurrency: 4 })", row -> actualRelationships.add(
136+
runQueryWithRowConsumer("CALL gds.beta.graph.relationships.stream('generatedGraph', ['*'], { concurrency: 10 })", row -> actualRelationships.add(
137137
relationship(
138138
row.getNumber("sourceNodeId").longValue(),
139139
row.getNumber("targetNodeId").longValue(),

0 commit comments

Comments
 (0)