You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/19 08:27:30 UTC

[GitHub] [flink] klion26 commented on a change in pull request #12078: [FLINK-17610][state]Align the behavior of result of internal map state to re…

klion26 commented on a change in pull request #12078:
URL: https://github.com/apache/flink/pull/12078#discussion_r427116721



##########
File path: flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBMapState.java
##########
@@ -227,6 +220,7 @@ public void migrateSerializedValue(
 		}
 	}
 
+	@Nonnull

Review comment:
       As the [code stye](https://flink.apache.org/contributing/code-style-and-quality-common.html#nullability-of-the-mutable-parts) said , we can get rid of the annotation.
   ```
   Note: This means that @Nonnull annotations are usually not necessary, but can be used in certain cases to override a previous annotation, or to point non-nullability out in a context where one would expect a nullable value.
   ```

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java
##########
@@ -2875,7 +2875,8 @@ public void testMapStateDefaultValue() throws Exception {
 				VoidNamespaceSerializer.INSTANCE, kvId);
 
 		backend.setCurrentKey(1);
-		assertNull(state.entries());
+		assertNotNull(state.entries());

Review comment:
       maybe we need to verify the result of `entries` is what we want.

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/heap/HeapMapState.java
##########
@@ -140,25 +141,25 @@ public boolean contains(UK userKey) {
 	@Override
 	public Iterable<Map.Entry<UK, UV>> entries() {
 		Map<UK, UV> userMap = stateTable.get(currentNamespace);
-		return userMap == null ? null : userMap.entrySet();
+		return userMap == null ? Collections.emptyList() : userMap.entrySet();

Review comment:
       Do we need to return `Collections.emptySet` here to align with the `userMap.entrySet()`?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org