From d295bf0390da029c3bc4a89cbe3f13b645431496 Mon Sep 17 00:00:00 2001 From: Paul Horn Date: Mon, 15 Jan 2024 16:18:58 +0100 Subject: [PATCH] Return the pruned config map from Cypher Projection v2 --- .../neo4j/gds/projection/GraphImporter.java | 2 +- ...aphProjectFromCypherAggregationConfig.java | 1 - .../gds/projection/CypherAggregationTest.java | 22 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphImporter.java b/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphImporter.java index 0d9cef5282..4f5bd28145 100644 --- a/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphImporter.java +++ b/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphImporter.java @@ -216,7 +216,7 @@ public AggregationResult result( .nodeCount(graphStore.nodeCount()) .relationshipCount(graphStore.relationshipCount()) .projectMillis(projectMillis) - .configuration(this.config.toMap()) + .configuration(this.config.asProcedureResultConfigurationField()) .query(this.query) .build(); } diff --git a/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphProjectFromCypherAggregationConfig.java b/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphProjectFromCypherAggregationConfig.java index 118ebd34da..576ffa5f5b 100644 --- a/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphProjectFromCypherAggregationConfig.java +++ b/cypher-aggregation/src/main/java/org/neo4j/gds/projection/GraphProjectFromCypherAggregationConfig.java @@ -78,7 +78,6 @@ default Set outputFieldDenylist() { return Set.of( NODE_COUNT_KEY, RELATIONSHIP_COUNT_KEY, - READ_CONCURRENCY_KEY, SUDO_KEY, VALIDATE_RELATIONSHIPS_KEY ); diff --git a/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java b/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java index 7f23c947e2..6320a2594e 100644 --- a/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java +++ b/cypher-aggregation/src/test/java/org/neo4j/gds/projection/CypherAggregationTest.java @@ -55,6 +55,7 @@ import org.neo4j.graphdb.Result; import org.neo4j.kernel.api.procedure.GlobalProcedures; +import java.time.ZonedDateTime; import java.util.List; import java.util.Map; import java.util.Optional; @@ -66,6 +67,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.hamcrest.Matchers.any; import static org.hamcrest.Matchers.instanceOf; import static org.neo4j.gds.utils.StringFormatting.formatWithLocale; @@ -779,6 +781,26 @@ void testPipelinePseudoAnonymous() { ); } + + @Test + void testReturnedConfig() { + var query = "MATCH (a:A)-[:REL]->(b) " + + "WITH gds.graph.project('g', a, b) AS g " + + "RETURN g.configuration AS config"; + assertCypherResult( + query, + List.of(Map.of("config", Map.of( + "creationTime", any(ZonedDateTime.class), + "inverseIndexedRelationshipTypes", List.of(), + "jobId", any(String.class), + "logProgress", true, + "query", query, + "readConcurrency", 4, + "undirectedRelationshipTypes", List.of() + ))) + ); + } + @Test void testAlphaForwarding() { runQuery(