alamb commented on code in PR #22114:
URL: https://github.com/apache/datafusion/pull/22114#discussion_r3634402201
##########
datafusion/functions/src/datetime/common.rs:
##########
@@ -41,6 +45,52 @@ const ERR_NANOSECONDS_NOT_SUPPORTED: &str = "The dates that
can be represented a
static UTC: LazyLock<Tz> = LazyLock::new(|| "UTC".parse().expect("UTC is
always valid"));
+/// Convert a `NaiveDate` into a `ScalarValue` matching `target_type`. The Date
+/// variants encode the bare date; Timestamp variants are anchored at the
+/// date's midnight in the given timezone. Returns `None` for unsupported
+/// target types.
+pub(crate) fn date_to_scalar(
Review Comment:
What do you think about making this a method on ScalarValue (like
`ScalarValue::try_from_date`, matching the existing methods like
https://docs.rs/datafusion/latest/datafusion/common/enum.ScalarValue.html#method.try_from_string)?
That might make it easier to discover in the future
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]