You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "CaoZhen (Jira)" <ji...@apache.org> on 2020/10/16 16:48:00 UTC
[jira] [Updated] (FLINK-19685) When use HBase-Connector
lookupFunction, 8 hours less to query `DATE`,`TIME`,`TIMESTAMP` data
[ https://issues.apache.org/jira/browse/FLINK-19685?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
CaoZhen updated FLINK-19685:
----------------------------
Description:
from the code:
HBaseSerde#createFieldDecoder
{code:java}
case DATE:
case INTERVAL_YEAR_MONTH:
return Bytes::toInt;
case TIME_WITHOUT_TIME_ZONE:
......
return Bytes::toInt;
case TIMESTAMP_WITHOUT_TIME_ZONE:
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
......
return createTimestampDecoder();
private static FieldDecoder createTimestampDecoder() {
return value -> {
// TODO: support higher precision
long milliseconds = Bytes.toLong(value);
return TimestampData.fromEpochMillis(milliseconds);
};
}
{code}
I think we should learn from JDBC's approach to dealing with time types.
{code:java}
case DATE:
return val -> (int) (((Date) val).toLocalDate().toEpochDay());
case TIME_WITHOUT_TIME_ZONE:
return val -> (int) (((Time) val).toLocalTime().toNanoOfDay() / 1_000_000L);
case TIMESTAMP_WITH_TIME_ZONE:
case TIMESTAMP_WITHOUT_TIME_ZONE:
return val -> TimestampData.fromTimestamp((Timestamp) val);
{code}
was:
from the code:
HBaseSerde#createFieldDecoder
{code:java}
case DATE:
case INTERVAL_YEAR_MONTH:
return Bytes::toInt;
case TIME_WITHOUT_TIME_ZONE:
......
return Bytes::toInt;
case TIMESTAMP_WITHOUT_TIME_ZONE:
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
......
return createTimestampDecoder();
private static FieldDecoder createTimestampDecoder() {
return value -> {
// TODO: support higher precision
long milliseconds = Bytes.toLong(value);
return TimestampData.fromEpochMillis(milliseconds);
};
}
{code}
> When use HBase-Connector lookupFunction, 8 hours less to query `DATE`,`TIME`,`TIMESTAMP` data
> ----------------------------------------------------------------------------------------------
>
> Key: FLINK-19685
> URL: https://issues.apache.org/jira/browse/FLINK-19685
> Project: Flink
> Issue Type: Bug
> Components: Connectors / HBase
> Reporter: CaoZhen
> Priority: Major
>
> from the code:
> HBaseSerde#createFieldDecoder
> {code:java}
> case DATE:
> case INTERVAL_YEAR_MONTH:
> return Bytes::toInt;
> case TIME_WITHOUT_TIME_ZONE:
> ......
> return Bytes::toInt;
> case TIMESTAMP_WITHOUT_TIME_ZONE:
> case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
> ......
> return createTimestampDecoder();
> private static FieldDecoder createTimestampDecoder() {
> return value -> {
> // TODO: support higher precision
> long milliseconds = Bytes.toLong(value);
> return TimestampData.fromEpochMillis(milliseconds);
> };
> }
> {code}
>
> I think we should learn from JDBC's approach to dealing with time types.
> {code:java}
> case DATE:
> return val -> (int) (((Date) val).toLocalDate().toEpochDay());
> case TIME_WITHOUT_TIME_ZONE:
> return val -> (int) (((Time) val).toLocalTime().toNanoOfDay() / 1_000_000L);
> case TIMESTAMP_WITH_TIME_ZONE:
> case TIMESTAMP_WITHOUT_TIME_ZONE:
> return val -> TimestampData.fromTimestamp((Timestamp) val);
> {code}
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)