Skip to content

Commit 0f15774

Browse files
committed
fix: insert into now works for vertices too
1 parent 792e70d commit 0f15774

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

engine/src/main/java/com/arcadedb/query/sql/executor/CopyDocumentStep.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import com.arcadedb.database.MutableDocument;
2323
import com.arcadedb.database.Record;
2424
import com.arcadedb.exception.TimeoutException;
25+
import com.arcadedb.graph.MutableVertex;
26+
import com.arcadedb.graph.Vertex;
2527
import com.arcadedb.schema.DocumentType;
2628

2729
/**
@@ -59,7 +61,14 @@ public Result next() {
5961
if (toCopy.isElement()) {
6062
final Record docToCopy = toCopy.getElement().get().getRecord();
6163

62-
if (docToCopy instanceof Document document) {
64+
if (docToCopy instanceof Vertex vertex) {
65+
if (targetType != null) {
66+
resultDoc = getContext().getDatabase().newVertex(targetType);
67+
} else {
68+
resultDoc = getContext().getDatabase().newVertex(vertex.getTypeName());
69+
}
70+
((MutableVertex) resultDoc).set(vertex.toMap(false));
71+
} else if (docToCopy instanceof Document document) {
6372
if (targetType != null) {
6473
resultDoc = getContext().getDatabase().newDocument(targetType);
6574
} else {

0 commit comments

Comments
 (0)