Abacn commented on code in PR #35335: URL: https://github.com/apache/beam/pull/35335#discussion_r2152990136
########## runners/local-java/src/main/java/org/apache/beam/runners/local/StructuralKey.java: ########## @@ -57,19 +58,34 @@ public static <K> StructuralKey<K> of(K key, Coder<K> coder) { private static class CoderStructuralKey<K> extends StructuralKey<K> { private final Coder<K> coder; - private final Object structuralValue; - private final byte[] encoded; + private final K key; - private CoderStructuralKey(Coder<K> coder, K key) throws Exception { + private byte @MonotonicNonNull [] encoded; + private @MonotonicNonNull Object structuralValue; + + private CoderStructuralKey(Coder<K> coder, K key) { this.coder = coder; - this.structuralValue = coder.structuralValue(key); - this.encoded = CoderUtils.encodeToByteArray(coder, key); + this.key = key; + } + + private byte[] getEncoded() throws CoderException { Review Comment: Is there any concern related to thread safe? Or we should just catch the checked Exception and throw RuntimeException in constructor? -- 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. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org