-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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
[FLINK-35241][table]Support SQL FLOOR and CEIL functions with SECOND and MINUTE for TIMESTAMP_TLZ #25759
base: master
Are you sure you want to change the base?
Conversation
df6a968
to
b498656
Compare
@flinkbot run azure |
@@ -432,15 +435,17 @@ private Stream<TestSetSpec> temporalOverlapsTestCases() { | |||
} | |||
|
|||
private Stream<TestSetSpec> ceilTestCases() { | |||
TimeZone.setDefault(TimeZone.getTimeZone("UTC")); | |||
return Stream.of( | |||
TestSetSpec.forFunction(BuiltInFunctionDefinitions.FLOOR) | |||
.onFieldsWithData( | |||
// https://issues.apache.org/jira/browse/FLINK-17224 |
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.
@hanyuzheng7 can you read this ticket and see if we should update this comment?
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.
@jnh5y Now, we test TIMESTAMP_TLZ, which means when we do the test, the result depend on the the timezone you run the test, so we should fix the timezone, so each people can pass these tests in their timezone. If I don't fix the time zone, these test can pass in my laptop, but cannot pass in flink ci server, because my time zone is different than flink ci server's time zone
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 can not make any assumption about flink ci timezone.
Nobody guarantees that together with movement to GitHub it stays same
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.
@snuyanzin I think I can extract these tests and generate an new stream TestCases. In this TestCases, I can fix the timeZone.
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.
that was the thing I initially tried to suggest
however need to be sure that after test stream finishes the timezone should be reset to the initial value
Is there any documentation for this function? If it mentions details, we may need to update them. |
} | ||
|
||
private Stream<TestSetSpec> floorTestCases() { | ||
TimeZone.setDefault(TimeZone.getTimeZone("UTC")); |
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.
that's weird that we set it for all test cases...
can we set it only for some certain test cases and then unset it back?
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.
Can we do that in floor and ceil test?
I think I can extract these tests and generate an new stream TestCases.
@flinkbot run azure |
…and MINUTE for TIMESTAMP_TLZ
104f37c
to
63ce219
Compare
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.
Tested locally
if I floor
/ceil
to millisecond
/nanosecond
I still receive same issue as in jira description
@snuyanzin Yes, because this ticket just handle the SECOND and MINUTE case. |
the root cause is same, if you compare output for different inputs, it will be same. |
@snuyanzin
for DAY and HOUR now base on
We can use 1L to stand for MILLIS_PER_MILLISECOND, but how can we stand for NANOSECOND, it is smaller than MILLISECOND. If we want to support it, we need change the time base from MILLISECOND to NANOSECOND, it will change lots of behavior for ceil and floor, so I suggest to generate an new ticket to support |
At least we have to support it for all timeunits for which we have already existing tests Lines 449 to 458 in 72b32fc
then same should be supported for case with cast as well. If there is no such for |
Support |
I will have a look at this tomorrow |
DateTimeFormatter.ofPattern( | ||
"yyyy-MM-dd' 'HH:mm:ss.SSS")), |
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.
btw this could be extracted into constant since it's used multiple times
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.
ok
I will open an jira ticket for it |
What is the purpose of the change
We need a fix for both SECOND and MINUTE.
The following query doesn't work:
These two queries work:
Stack trace for the first not working query from above:
Brief change log
(for example:)
Verifying this change
TimeFunctionsITCase
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation