delta-io / delta

An open-source storage framework that enables building a Lakehouse architecture with compute engines including Spark, PrestoDB, Flink, Trino, and Hive and APIs
https://delta.io
Apache License 2.0
7.62k stars 1.71k forks source link

[Spark] Allow setting the same active Delta transaction #3660

Closed cstavr closed 2 months ago

cstavr commented 2 months ago

Which Delta project/connector is this regarding?

Description

OptimisticTransaction.setActive() and OptimisticTransaction.withActive() methods will fail if the active transaction is already set, even if the caller tries to set the same transaction. This commit fixes this issue and allows setting the same transaction instance.

How was this patch tested?

New and existing tests.

Does this PR introduce any user-facing changes?

No