Skip to content

[Bug] make_date does not throw under spark.sql.ansi.enabled=true #4451

@andygrove

Description

@andygrove

Describe the bug

make_date(year, month, day) returns NULL for an invalid (year, month, day) triple even when spark.sql.ansi.enabled=true, where Spark throws via QueryExecutionErrors.ansiDateTimeError (3.4/3.5) / ansiDateTimeArgumentOutOfRange (4.0).

The native impl SparkMakeDate in native/spark-expr/src/datetime_funcs/make_date.rs always returns NULL and never raises.

Steps to reproduce

SET spark.sql.ansi.enabled=true;
SELECT make_date(2024, 2, 30);
-- Spark: throws ansiDateTimeArgumentOutOfRange / ansiDateTimeError
-- Comet: NULL

Expected behavior

Match Spark: throw under ANSI; return NULL otherwise.

Additional context

Surfaced by the date/time audit (#4448). Reproducer captured as an ignored test in spark/src/test/resources/sql-tests/expressions/datetime/make_date.sql; remove the ignore(...) when this is fixed.

Metadata

Metadata

Assignees

No one assigned

    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