bamaer opened a new issue, #8993:
URL: https://github.com/apache/hop/issues/8993

   ### Apache Hop version?
   
   2.20.0-SNAPSHOT (main, 2026-10-17)
   
   ### Java version?
   
   21
   
   ### Operating system
   
   macOS
   
   ### What happens
   
   A statement with `CALL { ... } IN TRANSACTIONS` fails in the Neo4j Cypher 
transform and in the Neo4j Cypher Script action. This is the batching syntax 
Neo4j recommends instead of `apoc.periodic.iterate`.
   
   ```cypher
   MATCH (n:Person) CALL (n) { SET n.processed = true } IN TRANSACTIONS OF 10 
ROWS
   ```
   
   Both fail with:
   
   ```
   org.neo4j.driver.exceptions.DatabaseException: A query with 'CALL { ... } IN 
TRANSACTIONS' can only be executed in an implicit transaction, but tried to 
execute in an explicit transaction.
   ```
   
   No nodes are updated. The same statement in `cypher-shell` (auto-commit) 
updates all nodes. Tested on Neo4j 5.26.31 Community, with `hop-run`:
   
   - Pipeline: Generate rows (1 row) → Cypher, batch size 1, not read-only, no 
UNWIND.
   - Workflow: Start → Neo4j Cypher Script with the statement above.
   
   ### Expected
   
   The statement runs in an auto-commit transaction and Neo4j commits each 
batch of rows.
   
   ### Cause
   
   Neo4j only accepts `CALL { ... } IN TRANSACTIONS` in an implicit 
(auto-commit) transaction. Both components run it in a managed transaction:
   
   - Cypher transform: `runStatementsInTransaction()` and `writeUnwindList()` 
use `session.executeWrite()` / `executeRead()` (`Cypher.java`). The transform 
already sends some statements to `runAutoCommitStatement()` when 
`IGraphDialect.isRequiringAutoCommit()` returns true. Only 
`MemgraphGraphDialect` overrides that method. `Neo4jGraphDialect` keeps the 
default, `false`.
   - Cypher Script action: runs the whole script in one 
`connection.executeWrite()` when `isSupportingSchemaChangesInTransactions()` is 
true, which is the case for Neo4j (`CypherScript.java`). `executeAutoCommit()` 
is only used when the dialect can't make schema changes in a transaction.
   
   ### Possible fix
   
   - `Neo4jGraphDialect.isRequiringAutoCommit()` returns true for statements 
with `CALL ... { ... } IN TRANSACTIONS`, for both the `CALL {` and `CALL (vars) 
{` forms. The Cypher transform then uses the existing auto-commit path.
   - The Cypher Script action runs statements that need auto-commit on their 
own, and the rest in a transaction, as the Cypher transform does.
   - Integration test in `integration-tests/neo4j` for both components.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to