Skip to content

Add case function  #447

@mesejo

Description

@mesejo

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I would like to add to use the case conditional function from Python.

Describe the solution you'd like
Ideally, I would like it to be possible to do something like the following:

df = df.select(
        f.case(column("a"))
        .when(literal("Hello"), literal("Hola"))
        .when(literal("World"), literal("Mundo"))
        .otherwise(literal("!!")),
    )

Describe alternatives you've considered
None

Additional context
This was suggested as a possible solution by @alamb in arrow-datafusion#7062 discussion

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions