Skip to content

Commit 3d632cc

Browse files
Merge pull request #11732 from soerenreichardt/arrow-graphstore-export
Arrow graphstore export
2 parents aa69057 + a69349a commit 3d632cc

3 files changed

Lines changed: 40 additions & 3 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.api;
21+
22+
import org.neo4j.gds.RelationshipType;
23+
24+
public interface GraphStoreWithTopology extends GraphStore {
25+
Topology getTopology(RelationshipType relationshipType);
26+
}

core/src/main/java/org/neo4j/gds/api/GraphStoreAdapter.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
import java.util.Optional;
3939
import java.util.Set;
4040

41-
public abstract class GraphStoreAdapter implements GraphStore {
41+
public abstract class GraphStoreAdapter implements GraphStoreWithTopology {
4242

4343
private final GraphStore graphStore;
4444

@@ -318,4 +318,14 @@ public CompositeRelationshipIterator getCompositeRelationshipIterator(
318318
) {
319319
return graphStore.getCompositeRelationshipIterator(relationshipType, propertyKeys);
320320
}
321+
322+
@Override
323+
public Topology getTopology(RelationshipType relationshipType) {
324+
if (graphStore instanceof GraphStoreWithTopology gWT) {
325+
return gWT.getTopology(relationshipType);
326+
}
327+
throw new UnsupportedOperationException(
328+
"GraphStore does not support getting topology for relationship type: " + relationshipType
329+
);
330+
}
321331
}

core/src/main/java/org/neo4j/gds/core/loading/CSRGraphStore.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.neo4j.gds.api.DatabaseInfo;
3131
import org.neo4j.gds.api.FilteredIdMap;
3232
import org.neo4j.gds.api.GraphCharacteristics;
33-
import org.neo4j.gds.api.GraphStore;
33+
import org.neo4j.gds.api.GraphStoreWithTopology;
3434
import org.neo4j.gds.api.IdMap;
3535
import org.neo4j.gds.api.PropertyState;
3636
import org.neo4j.gds.api.Topology;
@@ -77,7 +77,7 @@
7777
import static org.neo4j.gds.utils.StringFormatting.formatWithLocale;
7878

7979
@Value.Style(typeBuilder = "GraphStoreBuilder")
80-
public final class CSRGraphStore implements GraphStore {
80+
public final class CSRGraphStore implements GraphStoreWithTopology {
8181

8282
private final Concurrency concurrency;
8383

@@ -474,6 +474,7 @@ public DeletionResult deleteRelationships(RelationshipType relationshipType) {
474474
}));
475475
}
476476

477+
@Override
477478
public Topology getTopology(RelationshipType relationshipType) {
478479
return relationships.get(relationshipType).topology();
479480
}

0 commit comments

Comments
 (0)