Skip to content

array_contains returns wrong result for literal array with NULL cast #3345

@andygrove

Description

@andygrove

Description

When array_contains() is called with a literal cast(NULL as array<int>) argument, Comet returns a different result than Spark.

This was discovered when testing literal argument combinations for array functions with constant folding disabled.

How to Reproduce

SET spark.sql.optimizer.excludedRules=org.apache.spark.sql.catalyst.optimizer.ConstantFolding;
SELECT array_contains(cast(NULL as array<int>), 1);

Expected Behavior

Comet should return the same result as Spark for array_contains with a NULL array input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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