ksql
ksql copied to clipboard
Have GETDATE function instead of UNIX_TIMESTAMP to filter or call today's date
Most SQL database use the GETDATE function to use for filtering and other purposes to display "today's timestamp". Although ksqldb does offer UNIX_TIMESTAMP as an epoch time for the current date, it is a bit strange to name the function like this also to only be available for epoch time, especially if the user wants to add or subtract dates from it.
@colinhicks thoughts on the function name here?
Yeah, I understand the potential confusion with UNIX_TIMESTAMP
. This function was introduced before KSQL had a timestamp
type. When timestamp and date types were introduced, we also introduced utility functions to convert between them, such that you can do this today:
FROM_UNIXTIME(UNIX_TIMESTAMP()) -- returns TIMESTAMP representing the current timestamp
FROM_DAYS(UNIX_DATE()) -- returns DATE representing the current date
We can consider additional functions to make the above examples a single function call instead of two, but we'd want to think through whether the addition of more date/time-related functions could add to confusion, since there are already quite a few in this vein.