Skip to content

[SQL] Add CASE WHEN equivalent for the DECODE function #57534

Description

@art000109

Currently, the decode function is used only for decoding strings. However, a CASE WHEN equivalent has been available in the Spark SQL API since version 3.2.0

https://spark.apache.org/docs/latest/api/sql/string-functions/#decode

> SELECT decode(encode('abc', 'utf-8'), 'utf-8');
 abc
> SELECT decode(6, 1, 'Southlake', 2, 'San Francisco', 3, 'New Jersey', 4, 'Seattle', 'Non domestic');
 Non domestic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions