codeant-ai-for-open-source[bot] commented on code in PR #45546:
URL: https://github.com/apache/superset/pull/45546#discussion_r4395455166
##########
superset/commands/dataset/update.py:
##########
@@ -608,29 +613,31 @@ def _validate_partition_mapping(self, exceptions:
list[ValidationError]) -> None
ValidationError(reason,
field_name="partition_value_transform")
)
- def _effective_transform(
+ def _effective_column_attribute(
self,
columns: list[dict[str, Any]] | None,
- mapped_column: str | None,
+ column_name: str | None,
+ attribute: str,
) -> str | None:
"""
- The value transform on the effective mapped column.
+ One attribute of a named column, as this request will leave it.
Reads from the payload when the request carries columns, and from the
persisted model otherwise -- a PUT that changes only `partition_column`
- still has to be validated against the transform already stored.
+ still has to be validated against the transform already stored, and
+ against the expression of the column it now names.
"""
- if not mapped_column:
+ if not column_name:
return None
if columns is not None:
for column in columns:
- if column.get("column_name") == mapped_column:
- return column.get("partition_value_transform")
+ if column.get("column_name") == column_name:
+ return column.get(attribute)
Review Comment:
Yes. The validator should inspect the value the update will leave in
storage: if the payload omits `expression`, fall back to the existing column’s
expression; if it explicitly supplies `None`, treat that as a clear.
For example, a partial entry that omits `expression` must still validate the
stored `{{ ... }}` expression and block the save. Since column updates can also
identify a column by `id`, the fallback should locate the stored column by ID
when the payload does not provide a matching `column_name`. This closes the
validation gap while preserving intentional expression clears.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]