Skip to content

splitByString with CASE #78352

@caicre

Description

@caicre

Company or project name

No response

Describe what's wrong

This does not work and will report an error.

CREATE TABLE test_split (
    id Int32,
    input String
) ENGINE = Memory;
INSERT INTO test_split VALUES
(1, 'a#b#c#d');
SELECT
    id,
    CASE id
        WHEN 1 THEN splitByString('#', input)
        ELSE splitByString('', '')
    END AS result
FROM test_split;

But SELECT splitByString('#', input) FROM test_split and SELECT splitByString('', '') FROM test_split work normally.

Seems that CASE is having trouble when dealing with splitByString?

Does it reproduce on the most recent release?

Yes

How to reproduce

CREATE TABLE test_split (
    id Int32,
    input String
) ENGINE = Memory;
INSERT INTO test_split VALUES
(1, 'a#b#c#d');
SELECT
    id,
    CASE id
        WHEN 1 THEN splitByString('#', input)
        ELSE splitByString('', '')
    END AS result
FROM test_split;

Expected behavior

Ouput ['a','b','c','d']

Error message and/or stacktrace

Code: 36. DB::Exception: Unexpected type Array(String) in function 'transform'. (BAD_ARGUMENTS) (version 25.1.1.1807 (official build))

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    potential bugTo be reviewed by developers and confirmed/rejected.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions