Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-19685

When use HBase-Connector lookupFunction, 8 hours less to query `DATE`,`TIME`,`TIMESTAMP` data

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Connectors / HBase
    • Labels:
      None

      Description

      from the code:

      HBaseSerde#createFieldDecoder

      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);
         };
      }
      

       

      I think we should learn from JDBC's approach to dealing with time types.

      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);
      

       

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              caozhen1937 CaoZhen
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: