Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1959#discussion_r62490034
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/common/typeutils/base/DateComparator.java
 ---
    @@ -59,15 +55,37 @@ public boolean isNormalizedKeyPrefixOnly(int keyBytes) {
        }
     
        @Override
    -   public void putNormalizedKey(Date lValue, MemorySegment target, int 
offset, int numBytes) {
    -           long value = lValue.getTime() - Long.MIN_VALUE;
    -           
    +   public void putNormalizedKey(Date record, MemorySegment target, int 
offset, int numBytes) {
    +           putNormalizedKeyDate(record, target, offset, numBytes);
    +   }
    +
    +   @Override
    +   public DateComparator duplicate() {
    +           return new DateComparator(ascendingComparison);
    +   }
    +
    +   // 
--------------------------------------------------------------------------------------------
    +   //                           Static Helpers for Date Comparison
    +   // 
--------------------------------------------------------------------------------------------
    +
    +   public static int compareSerializedDate(DataInputView firstSource, 
DataInputView secondSource,
    +                   boolean ascendingComparison) throws IOException {
    +           final long l1 = firstSource.readLong();
    +           final long l2 = secondSource.readLong();
    +           final int comp = (l1 < l2 ? -1 : (l1 == l2 ? 0 : 1));
    +           return ascendingComparison ? comp : -comp;
    +   }
    +
    +   public static void putNormalizedKeyDate(Date record, MemorySegment 
target, int offset, int numBytes) {
    +           final long value = record.getTime() - Long.MIN_VALUE;
    +
                // see IntValue for an explanation of the logic
                if (numBytes == 8) {
                        // default case, full normalized key
                        target.putLongBigEndian(offset, value);
                }
                else if (numBytes <= 0) {
    --- End diff --
    
    No, this case is for numBytes of 0.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to