[
https://issues.apache.org/jira/browse/FLINK-11010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16714280#comment-16714280
]
ASF GitHub Bot commented on FLINK-11010:
----------------------------------------
lzqdename commented on issue #7180: [FLINK-11010] [TABLE] Flink SQL timestamp
is inconsistent with currentProcessingTime()
URL: https://github.com/apache/flink/pull/7180#issuecomment-445667532
In the Flink
to get process time ,the result is OK
then , In the Flink,the result is transfromed several times
for example , Long ->Timestamp ->Long->Timestamp
when Long ->Timestamp,use code as follows:**[In SqlFunctions]**
public static java.sql.Time internalToTime(int v) {
return new java.sql.Time(v - LOCAL_TZ.getOffset(v));
}
when Timestamp->Long,use code as follows:**[In SqlFunctions]**
// mainly intended for java.sql.Timestamp but works for other dates also
public static long toLong(java.util.Date v, TimeZone timeZone) {
final long time = v.getTime();
return time + timeZone.getOffset(time);
}
In the final write step,use code as follows:
protected long _timestamp(Date value) {
return value == null ? 0L : **value.getTime()**;
}
the position is
:org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.DateSerializer._timestamp
(DateSerializer.java:41)
now ,letme think, we use two different class to handle the transformation
between Long and Timestamp,
and the first class SqlFunctions imports TimeZone factor,
but the second class ,TimeZone factor not imported
It is not consitent when handling time transformation!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Flink SQL timestamp is inconsistent with currentProcessingTime()
> ----------------------------------------------------------------
>
> Key: FLINK-11010
> URL: https://issues.apache.org/jira/browse/FLINK-11010
> Project: Flink
> Issue Type: Bug
> Components: Table API & SQL
> Affects Versions: 1.6.2
> Reporter: lamber-ken
> Assignee: lamber-ken
> Priority: Major
> Labels: pull-request-available
>
> Flink SQL timestamp is inconsistent with currentProcessingTime().
>
> the ProcessingTime is just implemented by invoking System.currentTimeMillis()
> but the long value will be automatically wrapped to a Timestamp with the
> following statement:
> `new java.sql.Timestamp(time - TimeZone.getDefault().getOffset(time));`
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)