Skip to content

bug: incorrect mapping of *strip to *trim #1224

@ingomueller-net

Description

@ingomueller-net

What happened?

Ibis' strip, lstrip, and rstrip take no additional arguments and remove whitespace; Substrait's trim, ltrim, and rtrim, however, do take an additional argument, which specifies the characters that should be removed. Currently, *strip is mapped to *trim as is, leading to an exception because to signature of the form ('str',) is found for *trim. Instead, we should map to a call to *trim that builds a character set of whitespace characters.

Example:

def trim_expr(nation):
    new_col = nation.n_name.strip().name("trim_N_NAME")
    return nation[nation.n_name, new_col]

What version of ibis-substrait are you using?

ibis-framework==9.5.0
ibis-substrait==4.0.1

What substrait consumer(s) are you using, if any?

No response

Relevant log output

ValueError: No matching extension type found for function ltrim with input types ('str',)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions