tremor-rs / tremor-runtime

Main Tremor Project Rust Codebase
https://www.tremor.rs
Apache License 2.0
843 stars 128 forks source link

Datetime functions in tremor std namespace #396

Open anupdhml opened 3 years ago

anupdhml commented 3 years ago

Describe the problem you are trying to solve

A datetime module is absent from tremor-script stdlib right now. Functions related to datetime construction, parsing and formatting are useful in general for event processing needs.

There is already an underlying implementation for datetime functions in the tremor-script codebase (with datetime parse functionality utilized by datetime extractor) but the current implementation there needs rework and cleanup, so it was not exposed as part of tremor-script stdlib when the language got functions/modules (in v0.8).

As a workaround, these datetime functions can be currently accessed in tremor-script/trickle via core::datetime, and we as well as our users are relying on it for datetime needs (eg: as part of tests in the codebase itself). But this as a feature is intentionally undocumented so it's best if everyone moves away from it.

Describe the solution you'd like

Explore and propose ways in which the datetime module interface/implementation can be improved for usability and maintainability (eg: a lot of the functions there can now be implemented directly in tremor-script instead of rust). This can evolve into a RFC if the changes are substantial.

After discussions with @tremor-rs/tremor-core, implement the changes proposed.

As part of the implementation, make sure that the datetime extractor's functionality remains intact (also clean-up the currently broken datetime function links as part of the extractor's docs).

Notes

Datetime module docs from pre 0.8 days: https://github.com/tremor-rs/tremor-www-docs/blob/v0.7.3/docs/tremor-script/functions/datetime.md

As part of the cleanup, we can also take inspiration from other languages on how they expose such functionality.

Licenser commented 3 years ago

Yes! We need to clean up that module, a lot of the code can probably be implemented directly in tremorscript and not in a rust-function too which is kind of nice :)

mfelsche commented 2 years ago

We definitely need functions for producing timestamp strings (there are two RFC formats for this), as e.g. the google bigquery connector requires timestamp strings.

Licenser commented 9 months ago

1978 included some additiuonal asks