Skip to content

Conversation

@guptaakashdeep
Copy link
Contributor

Closes #1882

Rationale for this change

Feature request: Ability to pass transform name as string in add_fields

Are these changes tested?

Yes

Are there any user-facing changes?

Yes. Users will be able to pass transform names as string while calling add_fields method of update_spec.

@guptaakashdeep
Copy link
Contributor Author

@Fokko Requesting review whenever you can. More details on changes I added in #1882

Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

split nit about moving the function

return literal(func(lit.value))


def parse_transform(v: Any) -> Any:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intentional? seems like the function got moved lower

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinjqliu yes this is intentional.

I had to re-position the parse_transform method to change the return type of the method from Any to Transform[Any, Any] because mypy wasn't happy after we made Transform type as Union[str, Transform] in add_field. Without moving it down, Transform wasn't being recognized in the code.

@kevinjqliu kevinjqliu merged commit 0d56a3b into apache:main Apr 19, 2025
7 checks passed
@kevinjqliu
Copy link
Contributor

Thanks @guptaakashdeep

gabeiglio pushed a commit to Netflix/iceberg-python that referenced this pull request Aug 13, 2025
Closes apache#1882

# Rationale for this change
Feature request: Ability to pass transform name as string in
`add_fields`

# Are these changes tested?
Yes

# Are there any user-facing changes?
Yes. Users will be able to pass transform names as string while calling
add_fields method of update_spec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow passing in a string transform for tbl.update_spec().add_field()

2 participants