This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-8271-22b0518731a169c323a3f0683904ed94537c0d5c in repository https://gitbox.apache.org/repos/asf/texera.git
commit 103a0ebba1cbc42ad4622ab72d39087ad5765a14 Author: carloea2 <[email protected]> AuthorDate: Mon Nov 16 22:29:06 2026 +0000 feat(pyamber): isolate tuple copy storage (#8271) ### What changes were proposed in this PR? Give a tuple constructed from another tuple its own shallow field mapping. The initial field values remain the same, but later assignments no longer mutate the other tuple. ### Any related issues, documentation, discussions? Closes #8270 ### How was this PR tested? Retested with Python 3.12 in a fresh detached worktree from upstream main at `6db4a642d0`. All 102 selected Tuple tests pass, including independent edits in both directions. The two existing Windows timestamp-hash cases are excluded and covered separately by #8957. From `amber/`, after generating protobuf modules: ```sh python -m pytest src/test/python/core/models/test_tuple.py -k 'not test_hash' -q --tb=short -p no:cacheprovider python -m ruff check src/main/python src/test/python python -m ruff format --check src/main/python src/test/python ``` Ruff lint and formatting pass for all 218 Python files. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Codex --- amber/src/main/python/core/models/tuple.py | 2 +- amber/src/test/python/core/models/test_tuple.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/amber/src/main/python/core/models/tuple.py b/amber/src/main/python/core/models/tuple.py index 52be14642c..353fd6b0b3 100644 --- a/amber/src/main/python/core/models/tuple.py +++ b/amber/src/main/python/core/models/tuple.py @@ -192,7 +192,7 @@ class Tuple: assert len(tuple_like) != 0 self._field_data: "OrderedDict[str, Field]" if isinstance(tuple_like, Tuple): - self._field_data = tuple_like._field_data + self._field_data = tuple_like._field_data.copy() elif isinstance(tuple_like, pandas.Series): self._field_data = OrderedDict(tuple_like.to_dict()) else: diff --git a/amber/src/test/python/core/models/test_tuple.py b/amber/src/test/python/core/models/test_tuple.py index f0d9c4950d..88c63ded0b 100644 --- a/amber/src/test/python/core/models/test_tuple.py +++ b/amber/src/test/python/core/models/test_tuple.py @@ -42,6 +42,16 @@ class TestTuple: def test_tuple_from_series(self, target_tuple): assert Tuple(pandas.Series({"x": 1, "y": "a"})) == target_tuple + def test_tuple_copy_has_independent_field_storage(self, target_tuple): + copied = Tuple(target_tuple) + assert copied == target_tuple + + copied["x"] = 2 + target_tuple["y"] = "b" + + assert target_tuple["x"] == 1 + assert copied["y"] == "a" + def test_tuple_as_key_value_pairs(self, target_tuple): assert target_tuple.as_key_value_pairs() == [("x", 1), ("y", "a")]
