-
Notifications
You must be signed in to change notification settings - Fork 62
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
Updates Datum to use java.time for a sane datetime #1691
base: main
Are you sure you want to change the base?
Conversation
CROSS-ENGINE-REPORT ❌
Testing Details
Result Details
Now FAILING Tests ❌The following 5 test(s) were previously PASSING in BASE but are now FAILING in TARGET: Click here to see
Now IGNORED Tests ❌The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. Now Passing Tests180 test(s) were previously failing in BASE (LEGACY-V0.14.8) but now pass in TARGET (EVAL-BF3FE0F). Before merging, confirm they are intended to pass. The complete list can be found in GitHub CI summary, either from Step Summary or in the Artifact. CROSS-COMMIT-REPORT ✅
Testing DetailsResult Details
|
|
||
import java.math.BigDecimal; | ||
import java.math.BigInteger; | ||
import java.time.*; |
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.
nit: style-wise can use explicit imports
import org.jetbrains.annotations.NotNull; | ||
import org.partiql.types.PType; | ||
import org.partiql.value.datetime.Timestamp; | ||
|
||
import java.time.*; |
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.
nit: similarly here, can use explicit imports
import org.jetbrains.annotations.NotNull; | ||
import org.partiql.types.PType; | ||
|
||
import java.time.*; |
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.
nit: explicit imports
val upper = args[2].time | ||
val value = args[0].localTime | ||
val lower = args[1].localTime | ||
val upper = args[2].localTime |
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.
Seems like we're missing function definitions for timez and timestampz? Will those be added at some point? Similarly for the other builtin functions?
val now = TimestampWithTimeZone.nowZ() | ||
Datum.timestamp(now) | ||
val now = LocalDateTime.now() | ||
Datum.timestamp(now, 6) |
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.
Should this be a timestamp or timestampz?
// calculate second/nanos | ||
val ds = second.bigDecimal | ||
val seconds: Int = ds.toInt() | ||
val nanoOfSecond: Int = ds.remainder(BigDecimal.ONE).movePointRight(9).toInt() |
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.
nit: this is used in a few other places. perhaps could be some top-level variable/const?
|
||
@Test | ||
@Disabled("The planner does not return the v1 plans right now. See assertExpression.") // TODO | ||
fun testRandomDates() { |
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.
Why is this test getting removed?
@@ -736,18 +727,28 @@ static Datum blob(@NotNull byte[] value, int length) { | |||
// DATE/TIME | |||
|
|||
@NotNull | |||
static Datum date(@NotNull Date value) { | |||
static Datum date(@NotNull LocalDate value) { |
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.
Perhaps I'm missing some context for the changes here. I had a couple questions
- Why are we opting to use the Java-defined datetime classes rather than the currently-defined datetime classes/interfaces in SPI? I'm not opposed but just would like some more context here.
- Will those datetime classes/interfaced defined in SPI be deleted at some point?
Description
This PR updates Datum to use java.time.
See #1654
Other Information
and Code Style Guidelines? YES
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
< If YES, which ones and why? >
< In addition, please also mention any other alternatives you've considered and the reason they've been discarded >
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.