Skip to content

Commit

Permalink
Fix reading from Delta in a transaction
Browse files Browse the repository at this point in the history
Delta connector supports write in autocommit mode only, but it should
allow multiple reads in a transaction (e.g. reading from Delta and
writing to Hive connector).

The commit removes the check from `DeltaLakeConnector` since appropriate
check is being done in `InMemoryTransactionManager`.
  • Loading branch information
findepi committed Apr 6, 2022
1 parent 7562be6 commit a9d6dd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.Optional;
import java.util.Set;

import static com.google.common.base.Verify.verify;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static io.trino.spi.transaction.IsolationLevel.READ_COMMITTED;
import static io.trino.spi.transaction.IsolationLevel.checkConnectorSupports;
Expand Down Expand Up @@ -193,7 +192,6 @@ public Iterable<EventListener> getEventListeners()
public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit)
{
checkConnectorSupports(READ_COMMITTED, isolationLevel);
verify(autoCommit, "Catalog only supports writes using autocommit: DeltaLake");
ConnectorTransactionHandle transaction = new HiveTransactionHandle(true);
transactionManager.begin(transaction);
return transaction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,16 @@ public void testSelectAll()
assertQuery("SELECT * FROM orders");
}

@Test
public void testSelectInTransaction()
{
inTransaction(session -> {
assertQuery(session, "SELECT nationkey, name, regionkey FROM nation");
assertQuery(session, "SELECT regionkey, name FROM region");
assertQuery(session, "SELECT nationkey, name, regionkey FROM nation");
});
}

/**
* Test interactions between optimizer (including CBO), scheduling and connector metadata APIs.
*/
Expand Down

0 comments on commit a9d6dd8

Please sign in to comment.