waitingkuo commented on code in PR #4054:
URL: https://github.com/apache/arrow-datafusion/pull/4054#discussion_r1010323470
##########
datafusion/core/tests/sql/timestamp.rs:
##########
@@ -1651,3 +1651,34 @@ async fn test_current_date() -> Result<()> {
Ok(())
}
+
+#[tokio::test]
+async fn test_current_time() -> Result<()> {
+ let ctx = SessionContext::new();
+
+ let sql = "select current_time() dt";
+ let results = execute_to_batches(&ctx, sql).await;
+ assert_eq!(
+ results[0]
+ .schema()
+ .field_with_name("dt")
+ .unwrap()
+ .data_type()
+ .to_owned(),
+ DataType::Time64(TimeUnit::Nanosecond)
+ );
+
+ let sql = "select case when current_time() = (now()::bigint %
86400000000000)::time then 'OK' else 'FAIL' end result";
+ let results = execute_to_batches(&ctx, sql).await;
+
+ let expected = vec![
+ "+--------+",
+ "| result |",
+ "+--------+",
+ "| OK |",
+ "+--------+",
+ ];
Review Comment:
👍
--
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]