Skip to content

[Variant] cast_to_variant will panic on certain Date64 or Timestamp Values values #8155

@alamb

Description

@alamb

Describe the bug
cast_to_variant will panic for values of Date64 / Timestamp that can not be converted to NaiveDate

For example:

|v: i64| { Date64Type::to_naive_date_opt(v).unwrap() },

And

|v| NaiveTime::from_num_seconds_from_midnight_opt(v as u32, 0u32).unwrap(),

To Reproduce

Pass in some value that is not representable as a NaiveDate (needs research to figure out what that could be)

It will panic

Expected behavior

I think we should have some way to specify what to do if the conversion fails, similar to the cast kernel which has a strict mode

if strict is true, then if the conversion fails an error is returned
If struct is false, then if the conversion fails, a Null is output

Additional context

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions