Skip to content

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

Closed

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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