Package ai.velr

Class VelrTx

java.lang.Object
ai.velr.VelrTx
All Implemented Interfaces:
AutoCloseable

public final class VelrTx extends Object implements AutoCloseable
Explicit Velr transaction.

A transaction owns result streams, result tables, rows, and savepoints opened from it. Commit, roll back, or close the transaction when it is no longer needed. Closing a transaction closes any still-open child handles first.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    bindArrow(String logical, ArrowColumn... columns)
    Bind single-chunk Arrow C Data Interface columns as a logical table within this transaction.
    void
    bindArrow(String logical, List<ArrowColumn> columns)
    Bind single-chunk Arrow C Data Interface columns as a logical table within this transaction.
    void
    bindArrowChunks(String logical, ArrowColumn... columns)
    Bind chunked Arrow C Data Interface columns as a logical table within this transaction.
    void
    bindArrowChunks(String logical, List<ArrowColumn> columns)
    Bind chunked Arrow C Data Interface columns as a logical table within this transaction.
    void
    bindArrowIpc(String logical, byte[] ipcBytes)
    Bind Arrow IPC file / Feather v2 bytes as a logical table within this transaction.
    void
    Close this transaction without committing it.
    void
    Commit this transaction.
    exec(String cypher)
    Execute an openCypher statement inside this transaction and stream every result table it produces.
    exec(String cypher, QueryOptions options)
    Execute an openCypher statement with query options inside this transaction and stream every result table it produces.
    execOne(String cypher)
    Execute an openCypher statement inside this transaction that is expected to produce exactly one result table.
    execOne(String cypher, QueryOptions options)
    Execute an openCypher statement with query options inside this transaction that is expected to produce exactly one result table.
    boolean
    Return whether this transaction has been closed, committed, or rolled back.
    query(String cypher)
    Execute an openCypher statement inside this transaction and collect the single result table as object maps.
    query(String cypher, QueryOptions options)
    Execute an openCypher statement with query options inside this transaction and collect the single result table as object maps.
    void
    registerChild(ai.velr.ChildHandle child)
    Driver-internal child-handle registration hook.
    void
    Release an active named savepoint.
    void
    Roll back this transaction.
    void
    Roll back this transaction to an active named savepoint.
    void
    run(String cypher)
    Execute an openCypher statement inside this transaction and discard any result tables.
    void
    run(String cypher, QueryOptions options)
    Execute an openCypher statement with query options inside this transaction and discard any result tables.
    Create a scoped savepoint.
    Create a named savepoint.
    void
    unregisterChild(ai.velr.ChildHandle child)
    Driver-internal child-handle registration hook.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isClosed

      public boolean isClosed()
      Return whether this transaction has been closed, committed, or rolled back.
      Returns:
      true after the transaction handle is no longer open
    • exec

      public StreamTx exec(String cypher)
      Execute an openCypher statement inside this transaction and stream every result table it produces.
      Parameters:
      cypher - openCypher statement
      Returns:
      a stream of result tables
    • exec

      public StreamTx exec(String cypher, QueryOptions options)
      Execute an openCypher statement with query options inside this transaction and stream every result table it produces.
      Parameters:
      cypher - openCypher statement
      options - query options such as parameters and row limits
      Returns:
      a stream of result tables
    • execOne

      public Table execOne(String cypher)
      Execute an openCypher statement inside this transaction that is expected to produce exactly one result table.
      Parameters:
      cypher - openCypher statement
      Returns:
      the single result table
    • execOne

      public Table execOne(String cypher, QueryOptions options)
      Execute an openCypher statement with query options inside this transaction that is expected to produce exactly one result table.
      Parameters:
      cypher - openCypher statement
      options - query options such as parameters and row limits
      Returns:
      the single result table
    • run

      public void run(String cypher)
      Execute an openCypher statement inside this transaction and discard any result tables.
      Parameters:
      cypher - openCypher statement
    • run

      public void run(String cypher, QueryOptions options)
      Execute an openCypher statement with query options inside this transaction and discard any result tables.
      Parameters:
      cypher - openCypher statement
      options - query options such as parameters and row limits
    • query

      public List<Map<String,Object>> query(String cypher)
      Execute an openCypher statement inside this transaction and collect the single result table as object maps.
      Parameters:
      cypher - openCypher statement
      Returns:
      collected rows
    • query

      public List<Map<String,Object>> query(String cypher, QueryOptions options)
      Execute an openCypher statement with query options inside this transaction and collect the single result table as object maps.
      Parameters:
      cypher - openCypher statement
      options - query options such as parameters and row limits
      Returns:
      collected rows
    • bindArrowIpc

      public void bindArrowIpc(String logical, byte[] ipcBytes)
      Bind Arrow IPC file / Feather v2 bytes as a logical table within this transaction.

      The byte array is borrowed only for the duration of the call. Velr decodes the IPC file and owns the resulting Arrow arrays before this method returns. Arrow IPC stream bytes are not accepted by this method.

      Parameters:
      logical - logical table name to expose to queries
      ipcBytes - Arrow IPC file / Feather v2 bytes
    • bindArrow

      public void bindArrow(String logical, List<ArrowColumn> columns)
      Bind single-chunk Arrow C Data Interface columns as a logical table within this transaction.

      For each column, the ArrowArray address is transferred to Velr by this call. Do not use or release transferred arrays after calling this method. The ArrowSchema address is not consumed and may be released after this method returns.

      Parameters:
      logical - logical table name to expose to queries
      columns - one or more Arrow columns
    • bindArrow

      public void bindArrow(String logical, ArrowColumn... columns)
      Bind single-chunk Arrow C Data Interface columns as a logical table within this transaction.
      Parameters:
      logical - logical table name to expose to queries
      columns - one or more Arrow columns
    • bindArrowChunks

      public void bindArrowChunks(String logical, List<ArrowColumn> columns)
      Bind chunked Arrow C Data Interface columns as a logical table within this transaction.

      Each column may contain one or more chunks. For every chunk, the ArrowArray address is transferred to Velr by this call. Do not use or release transferred arrays after calling this method. The ArrowSchema address is not consumed and may be released after this method returns.

      Parameters:
      logical - logical table name to expose to queries
      columns - one or more Arrow columns
    • bindArrowChunks

      public void bindArrowChunks(String logical, ArrowColumn... columns)
      Bind chunked Arrow C Data Interface columns as a logical table within this transaction.
      Parameters:
      logical - logical table name to expose to queries
      columns - one or more Arrow columns
    • savepoint

      public Savepoint savepoint()
      Create a scoped savepoint.

      The returned savepoint can be released or rolled back directly. Close the savepoint if it is no longer needed and no action should be taken.

      Returns:
      an open savepoint handle
    • savepointNamed

      public Savepoint savepointNamed(String name)
      Create a named savepoint.

      Named savepoints can be addressed later with rollbackTo(String) and releaseSavepoint(String) while they remain active.

      Parameters:
      name - savepoint name
      Returns:
      an open savepoint handle
    • rollbackTo

      public void rollbackTo(String name)
      Roll back this transaction to an active named savepoint.

      The target savepoint remains active after rollback; savepoints created after it are no longer active.

      Parameters:
      name - savepoint name
    • releaseSavepoint

      public void releaseSavepoint(String name)
      Release an active named savepoint.

      Velr releases named savepoints from the top of the savepoint stack.

      Parameters:
      name - savepoint name
    • commit

      public void commit()
      Commit this transaction.

      After commit, this transaction handle is closed and cannot be reused.

    • rollback

      public void rollback()
      Roll back this transaction.

      After rollback, this transaction handle is closed and cannot be reused.

    • close

      public void close()
      Close this transaction without committing it.
      Specified by:
      close in interface AutoCloseable
    • registerChild

      public void registerChild(ai.velr.ChildHandle child)
      Driver-internal child-handle registration hook.
    • unregisterChild

      public void unregisterChild(ai.velr.ChildHandle child)
      Driver-internal child-handle registration hook.