-
Notifications
You must be signed in to change notification settings - Fork 323
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
Adding new Date/Time operations (-
, date_add
, date_diff
, date_part
)
#7221
Conversation
f8a5f6a
to
4a14343
Compare
distribution/lib/Standard/Database/0.0.0-dev/src/Data/Column.enso
Outdated
Show resolved
Hide resolved
`Nothing` for most operations, but some operations that need to be | ||
parametrized by additional settings can use this field to pass that | ||
information to the code generator. | ||
Operation (kind : Text) (expressions : Vector SQL_Expression) (metadata : Any | Nothing = Nothing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have a more restrictive type than Any | Nothing
? Such as Row_Number_Metadata | Date_Period_Metadata
? Or do you think there will be too many?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably.
I'm not sure if this gives us much benefit - since the 'right' type depends on the particular kind
anyway, this will not be checking much. We definitely want stronger typing in the new IR, but with this one which is rather dynamic, I'd stick to it I think.
Ideally we should have one parent 'class' or interface for the metadata, but due to lack of inheritance/interfaces we cannot have it. The sum type could work, but I'm afraid it could become long - ideally we should define an alias in the file with metadata and only reference the alias here - but type aliases are not supported yet.
e0f3a84
to
7bb51df
Compare
-
, date_add
, date_diff
)-
, date_add
, date_diff
, date_part
)
distribution/lib/Standard/Table/0.0.0-dev/src/Data/Type/Value_Type_Helpers.enso
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - minor comment but great to have this in.
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Time/Date_Period.enso
Outdated
Show resolved
Hide resolved
8dfbc07
to
bc918df
Compare
… some docs, added microseconds Time_Period
``` C:\NBO\enso\test\Tests\src\Data\Text\Regex_Spec.enso:6:1: warning: Duplicated import of Regex. The original import is 'from Standard.Base.Main import all' in Regex_Spec.enso[1:1-1:29]. 6 | import Standard.Base.Data.Text.Regex.Regex ```
…stuff more consistent
…- otherwise it was very confusing
2a64fc8
to
4d5f00d
Compare
Pull Request Description
Column.date_diff
for computing date/time difference as integer multiply of some unit.Column.date_add
for shifting date/time by a unit.Column.date_part
for extracting various parts of the date/time value as integer.Column.hour
,Column.minute
andColumn.second
to extract these date parts.Time_Period
with support for milli-, micro- and nano- seconds; and adapts functions takingTime_Period
to support these wherever possible.Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.