-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement to_unixtime()
function
#1103
Comments
Hi @etolbakov, thanks for your interest! That TODO is doable now. But DataFusion doesn't have
Are you willing to take the first task? |
@waynexia yeah, I can give it go if it's not super urgent. |
|
@waynexia Is this true?
|
@waynexia I want to know how to add a UDF in sql. |
That's it 👍
You can take |
Close as completed. Thanks again @etolbakov |
Looks like the create table test(a int, b timestamp time index);
insert into test values(1, 2); And try to use
Report error:
I think this function should accept fn signature(&self) -> Signature {
Signature::uniform(1,
vec![ConcreteDataType::String(StringType), ConcreteDataType::Timestamp(TimestampType)],
Volatility::Immutable,
)
} |
@killme2008 I'm happy to add a fix here if it's not super urgent |
Cool, it's not urgent. Appreciate it if you can fix it. Thank you. |
What problem does the new feature solve?
Currently, we display all timestamp type in RFC3339 format, which is human-readable and widely used. However, sometimes we may need to convert them to the unix timestamp format, which is a number of seconds since January 1st 1970. This can be useful for debugging purposes, such as comparing timestamps across different sources or systems.
What does the feature do?
The feature will add a new UDF called
to_unixtime()
, which takes a timestamp in RFC3339 format as an input and returns its equivalent unix timestamp as an output. For example,to_unixtime("2023-03-01T06:35:02Z")
will return1678269302
. The UDF will also handle different time zones and leap seconds correctly.And when applied to a column with TIMESTAMP as type,
to_unixtime
will change how it's displayed.We have implemented
from_unixtime()
which can be referenced. It does the opposite conversion.Implementation challenges
No response
The text was updated successfully, but these errors were encountered: