You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "TiansuYu (via GitHub)" <gi...@apache.org> on 2024/08/21 10:16:31 UTC
[PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
TiansuYu opened a new pull request, #1083:
URL: https://github.com/apache/iceberg-python/pull/1083
(no comment)
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "TiansuYu (via GitHub)" <gi...@apache.org>.
TiansuYu commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1727383478
##########
tests/table/test_init.py:
##########
@@ -512,6 +512,29 @@ def test_add_column(table_v2: Table) -> None:
assert apply_schema.highest_field_id == 4
+def test_update_column_doc(table_v1: Table, table_v2: Table) -> None:
+ COMMENT2 = "comment2"
+ for table in [table_v1, table_v2]:
+ original_schema = table.schema()
+ # update existing doc to a new doc
+ assert original_schema.find_field("y").doc == "comment"
+ new_schema = table.transaction().update_schema().update_column("y", doc=COMMENT2)._apply()
+ assert new_schema.find_field("y").doc == COMMENT2, "failed to update existing field doc"
+
+ # update existing doc to an emtpy string
+ assert new_schema.find_field("y").doc == COMMENT2
+ new_schema2 = table.transaction().update_schema().update_column("y", doc="")._apply()
+ assert new_schema2.find_field("y").doc == "", "failed to remove existing field doc"
+
+ # assert the above two updates also works with union_by_name
+ assert (
+ table.update_schema().union_by_name(new_schema)._apply() == new_schema
+ ), "failed to update existing field doc with union_by_name"
+ assert (
+ table.update_schema().union_by_name(new_schema2)._apply() == new_schema2
+ ), "failed to remove existing field doc with union_by_name"
+
+
Review Comment:
Will do
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729922493
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
Hi @TiansuYu please take a look at this comment and let me know what you think!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1731284834
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,20 +2492,25 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
required=updated.required,
)
else:
self._updates[field.field_id] = NestedField(
field_id=field.field_id,
name=field.name,
field_type=field_type or field.field_type,
- doc=doc or field.doc,
+ doc=doc if doc is not None else field.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
Review Comment:
```suggestion
```
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,20 +2492,25 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
Review Comment:
```suggestion
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729655424
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
)
else:
self._updates[field.field_id] = NestedField(
field_id=field.field_id,
name=field.name,
field_type=field_type or field.field_type,
- doc=doc or field.doc,
- required=field.required,
+ doc=doc if doc is not None else field.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or field.required,
Review Comment:
```suggestion
required=field.required,
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1727268386
##########
pyproject.toml:
##########
@@ -16,7 +16,7 @@
# under the License.
[tool.poetry]
name = "pyiceberg"
-version = "0.7.1"
+version = "0.7.2"
Review Comment:
We will update this version when and if we release 0.7.2
```suggestion
version = "0.7.1"
```
##########
tests/table/test_init.py:
##########
@@ -512,6 +512,29 @@ def test_add_column(table_v2: Table) -> None:
assert apply_schema.highest_field_id == 4
+def test_update_column_doc(table_v1: Table, table_v2: Table) -> None:
+ COMMENT2 = "comment2"
+ for table in [table_v1, table_v2]:
+ original_schema = table.schema()
+ # update existing doc to a new doc
+ assert original_schema.find_field("y").doc == "comment"
+ new_schema = table.transaction().update_schema().update_column("y", doc=COMMENT2)._apply()
+ assert new_schema.find_field("y").doc == COMMENT2, "failed to update existing field doc"
+
+ # update existing doc to an emtpy string
+ assert new_schema.find_field("y").doc == COMMENT2
+ new_schema2 = table.transaction().update_schema().update_column("y", doc="")._apply()
+ assert new_schema2.find_field("y").doc == "", "failed to remove existing field doc"
+
+ # assert the above two updates also works with union_by_name
+ assert (
+ table.update_schema().union_by_name(new_schema)._apply() == new_schema
+ ), "failed to update existing field doc with union_by_name"
+ assert (
+ table.update_schema().union_by_name(new_schema2)._apply() == new_schema2
+ ), "failed to remove existing field doc with union_by_name"
+
+
Review Comment:
Could we add a case to verify your fix for the `required` field attribute as well?
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
😱
This looks correct to me. Thank you for the fix!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "TiansuYu (via GitHub)" <gi...@apache.org>.
TiansuYu commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729866980
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
Review Comment:
why the revert? Have I missed anything?
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729931129
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
Review Comment:
Hi @TiansuYu , while reviewing your test case I noticed that this is already being handled: https://github.com/apache/iceberg-python/blob/0e6ce1dc8fee21c3b45381961a8902d1ca1ed933/pyiceberg/table/__init__.py#L2513
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729655377
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
Review Comment:
```suggestion
required=updated.required,
```
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729931129
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
Review Comment:
Hi @TiansuYu , while reviewing your test case I noticed that this is already being handled: https://github.com/apache/iceberg-python/blob/0e6ce1dc8fee21c3b45381961a8902d1ca1ed933/pyiceberg/table/__init__.py#L2513
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729934598
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,26 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ # will raise ValidatorError
+ # if trying to change an identifier field from required to optional upon commit
+ required=required or updated.required,
Review Comment:
> Hi @TiansuYu , I left a comment up there but reposting here as well.
While reviewing below test case that updates the required flag I noticed that this is already being handled: https://github.com/apache/iceberg-python/blob/0e6ce1dc8fee21c3b45381961a8902d1ca1ed933/pyiceberg/table/__init__.py#L2513
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729922493
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
Hi @TiansuYu please take a look at this comment and let me know what you think!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "TiansuYu (via GitHub)" <gi...@apache.org>.
TiansuYu commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1724823854
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
Let me know the original code is the intended behavior.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1729156712
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
Actually @TiansuYu - I think column requirement setting is handled here: https://github.com/apache/iceberg-python/pull/1083/files#diff-23e8153e0fd497a9212215bd2067068f3b56fa071770c7ef326db3d3d03cee9bR2518
This is because changing the required flag involves checking if incompatible changes are allowed on this `UpdateSchema` instance
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "TiansuYu (via GitHub)" <gi...@apache.org>.
TiansuYu commented on code in PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#discussion_r1726626714
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
@sungwy I have fixed this as well. let me know if this ignorance is intended in the first place.
##########
pyiceberg/table/__init__.py:
##########
@@ -2492,21 +2492,22 @@ def update_column(
except ResolveError as e:
raise ValidationError(f"Cannot change column type: {full_name}: {field.field_type} -> {field_type}") from e
+ # if other updates for the same field exist in one transaction:
if updated := self._updates.get(field.field_id):
self._updates[field.field_id] = NestedField(
field_id=updated.field_id,
name=updated.name,
field_type=field_type or updated.field_type,
- doc=doc or updated.doc,
- required=updated.required,
+ doc=doc if doc is not None else updated.doc,
+ required=required or updated.required,
Review Comment:
Let me know the original code is the intended behavior.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "sungwy (via GitHub)" <gi...@apache.org>.
sungwy merged PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] fix (issue-1079): allow update_column to set doc as '' [iceberg-python]
Posted by "TiansuYu (via GitHub)" <gi...@apache.org>.
TiansuYu commented on PR #1083:
URL: https://github.com/apache/iceberg-python/pull/1083#issuecomment-2301686076
TODO: add test cases
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org