flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GJL <...@git.apache.org>
Subject [GitHub] flink pull request #5236: [FLINK-8322] support getting number of existing ti...
Date Wed, 03 Jan 2018 16:18:57 GMT
Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5236#discussion_r159464428
  
    --- Diff: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/HeapInternalTimerService.java
---
    @@ -475,4 +483,38 @@ public int getLocalKeyGroupRangeStartIdx() {
     	public Set<InternalTimer<K, N>>[] getProcessingTimeTimersPerKeyGroup() {
     		return this.processingTimeTimersByKeyGroup;
     	}
    +
    +	private void incrementProcessingTimeTimer(K key, N namespace) {
    +		incrementTimeTimer(processingTimeNumberTimers, key, namespace);
    +	}
    +
    +	private void incrementEventTimeTimer(K key, N namespace) {
    +		incrementTimeTimer(eventTimeNumberTimers, key, namespace);
    +	}
    +
    +	private void incrementTimeTimer(Table<K, N, Integer> table, K key, N namespace)
{
    +		if (table.contains(key, namespace)) {
    +			table.put(key, namespace, table.get(key, namespace) + 1);
    +		} else {
    +			table.put(key, namespace, 1);
    +		}
    +	}
    +
    +	private void decrementProcessingTimeTimer(K key, N namespace) {
    +		decrementTimeTimer(processingTimeNumberTimers, key, namespace);
    +	}
    +
    +	private void decrementEventTimeTimer(K key, N namespace) {
    +		decrementTimeTimer(eventTimeNumberTimers, key, namespace);
    +	}
    +
    +	private void decrementTimeTimer(Table<K, N, Integer> table, K key, N namespace)
{
    +		if (table.contains(key, namespace)) {
    --- End diff --
    
    Can it actually happen that the `(key, namespace)` is not in the table? If it should not
happen, maybe 
     a `checkState` is better.


---

Mime
View raw message