Skip to content

SQL: IMPORT DATABASE misses edge #1198

Closed
Closed

Description

@gramian

ArcadeDB Version: ArcadeDB Server v23.7.1-SNAPSHOT (build 2ed2834735647841ad33d9b76408221bfc96055d/1690912950007/main)

OS and JDK Version: Running on Mac OS X 12.6.5 - OpenJDK 64-Bit Server VM 11.0.19 (Homebrew)

Expected behavior

Correct import of graph from CSV files.

Actual behavior

  • Importer skips last edge
  • Repreating the import command causes error Error on importing database / Error on parsing source 'edges.csv (compressed=false size=41)' / Transaction not begun
Details
Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandExecutionException: Error on importing database
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:69)
	at com.arcadedb.query.sql.executor.SingleOpExecutionPlan.executeInternal(SingleOpExecutionPlan.java:91)
	at com.arcadedb.query.sql.parser.SimpleExecStatement.execute(SimpleExecStatement.java:64)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:73)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:101)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1299)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:451)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:123)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:91)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:98)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:124)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source 'edges.csv (compressed=false size=41)'
	at com.arcadedb.integration.importer.Importer.load(Importer.java:63)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:61)
	... 17 more
Caused by: com.arcadedb.exception.DatabaseOperationException: Transaction not begun
	at com.arcadedb.database.EmbeddedDatabase.checkTransactionIsActive(EmbeddedDatabase.java:1250)
	at com.arcadedb.database.EmbeddedDatabase.lambda$commit$2(EmbeddedDatabase.java:359)
	at com.arcadedb.database.EmbeddedDatabase.executeInReadLock(EmbeddedDatabase.java:1361)
	at com.arcadedb.database.EmbeddedDatabase.commit(EmbeddedDatabase.java:358)
	at com.arcadedb.integration.importer.graph.GraphImporter.close(GraphImporter.java:82)
	at com.arcadedb.integration.importer.format.CSVImporterFormat.loadEdges(CSVImporterFormat.java:368)
	at com.arcadedb.integration.importer.format.CSVImporterFormat.load(CSVImporterFormat.java:69)
	at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:95)
	at com.arcadedb.integration.importer.Importer.load(Importer.java:57)
	... 22 more
  • Is the <URL> necessary in IMPORT DATABASE when I have no documents? Should it be optional?

Steps to reproduce

IMPORT DATABASE file://vertices.csv WITH
vertices = vertices.csv, edges = edges.csv, database = test,
typeIdProperty = Id, typeIdType = Long, typeIdPropertyIsUnique = true,
edgeFromField = `From`, edgeToField = To;

and CSV files vertices.csv:

Id,First Name,Last Name
0,Jay,Miner
1,Elon,Musk
2,Steve,Jobs
3,Isaac,Newton
4,Nikola,Tesla
5,Albert,Einstein

and edges.csv:

From,To,Since
0,1,1990
0,2,2005
1,4,1970

Activity

  1. self-assigned this
    on Jan 22, 2026
  2. added this to the 26.1.1 milestone on Jan 22, 2026
  3. added theissue type on Jan 22, 2026
  4. added
    in progress
    on Jan 22, 2026
  5. lvca commented on Jan 22, 2026

    @lvca
    Member

    The bug was in CreateEdgeFromImportTask.execute(). Edges are batched by source vertex key for efficiency, and the batch is only flushed when the source key changes to a new
    vertex. When edge processing completes:

    • Each async thread has its own threadContext with a connections list
    • The last batch of edges for each thread was never flushed because there was no subsequent edge to trigger the flush

    This meant ALL edges could be lost if:

    1. All edges had the same source vertex (single batch never flushed)
    2. Multiple threads processed edges - each thread lost its last batch
  6. added a commit that references this issue on Jan 22, 2026
  7. added and removed
    in progress
    on Jan 22, 2026
  8. lvca commented on Jan 22, 2026

    @lvca
    Member

    Finally closed 👏

  9. gramian commented on Jan 22, 2026

    @gramian
    CollaboratorAuthor

    Not completely working yet:

    IMPORT DATABASE WITH vertices = vertices.csv, edges = edges.csv, typeIdProperty = Id, typeIdType = Long, typeIdPropertyIsUnique = true, edgeFromField = `From`, edgeToField = To;
    
    • Works from console
    • Fails from Studio (Error on importing database -> Error on parsing source 'null' -> vertices.csv)
  10. lvca commented on Jan 23, 2026

    @lvca
    Member

    Probably studio can't access to the file because run from a server and the file is not in the right path?

  11. modified the milestones: 26.1.1, 26.2.1 on Jan 23, 2026
  12. gramian commented on Jan 27, 2026

    @gramian
    CollaboratorAuthor

    This works for me now:

    IMPORT DATABASE WITH vertices = "file://vertices.csv", edges = "file://edges.csv", typeIdProperty = Id, typeIdType = Long, typeIdPropertyIsUnique = true, edgeFromField = "From", edgeToField = "To";
    

    Thank you!

  13. added a commit that references this issue on Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions