vvysotskyi commented on a change in pull request #2040: DRILL-7668: Allow Time
Bucket Function to Accept Floats and Timestamps
URL: https://github.com/apache/drill/pull/2040#discussion_r403733469
##########
File path:
contrib/udfs/src/test/java/org/apache/drill/exec/udfs/TestTimeBucketFunction.java
##########
@@ -92,6 +94,28 @@ public void testTimeBucket() throws Exception {
.go();
}
+ @Test
+ public void testDoubleTimeBucket() throws Exception {
+ String query = "SELECT time_bucket(CAST(1451606760 AS DOUBLE), 300000) AS
high FROM (values(1))";
+ testBuilder()
+ .sqlQuery(query)
+ .ordered()
+ .baselineColumns("high")
+ .baselineValues(1451400000L)
+ .go();
+ }
+
+ @Test
+ public void testTimeBucketTimestamp() throws Exception {
+ String query = "SELECT time_bucket(CAST(1585272833845 AS TIMESTAMP),
300000) AS high FROM (values(1))";
Review comment:
Could you please replace it with string representation, it looks more
friendly and helps to understand the source value:
```suggestion
String query = "SELECT time_bucket(timestamp '2020-03-27 01:33:53.845',
300000) AS high";
```
Also, there is no need to specify `FROM (values(1))` if it is not used.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services