Skip to content

Support array literal with struct #8873

@jayzhan211

Description

@jayzhan211

Describe the bug

array literal with struct occurs error, the reason is that we only consider Array function as valid type. It seems we should also accept Struct

                    if fun == BuiltinScalarFunction::MakeArray {
                        values.push(value);
                    } else {
                        // BuiltinScalarFunction::Struct

                        return not_impl_err!(
                            "ScalarFunctions without MakeArray are not supported: {value}"
                        );
                    }

To Reproduce

query error DataFusion error: This feature is not implemented: ScalarFunctions without MakeArray are not supported: struct\(Utf8\("x"\), Int64\(1\)\)
select [struct('x', 1)];

Expected behavior

We can see make_array did the good job here.

query ?
select make_array(struct('x', 1));
----
[{c0: x, c1: 1}]

Additional context

Bug found while looking into #8867

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions