Skip to content

EXTRACT(EPOCH from column) #2785

Description

@mkmik

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Datafusion supports a few date parts like "year" or "seconds" in the EXTRACT operator.

Postgres offers a few more. In particular it offers an EPOCH date part which extracts the number of seconds since 1970-01-01 00:00:00-00 (can be negative).

See https://www.postgresql.org/docs/8.1/functions-datetime.html

My particular use case is using pre-existing grafana postgres plugin, which crafts queries with such a construct. But I think it would be generally useful to support converting a timestamp to a unix epoch.

Describe the solution you'd like

select EXTRACT(EPOCH from column) from mytable;

Describe alternatives you've considered

select CAST(column AS bigint)/1000000000 from mytable;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions