liuliuOD commented on code in PR #24015:
URL: https://github.com/apache/kafka/pull/24015#discussion_r4420821828
##########
streams/src/test/java/org/apache/kafka/streams/kstream/internals/KTableKTableForeignKeyJoinScenarioTest.java:
##########
@@ -376,6 +378,43 @@ public void
shouldWorkWithCompositeKeyAndBiFunctionExtractor(final boolean withH
}
}
+ @ParameterizedTest
+ @ValueSource(booleans = {false, true})
+ public void shouldNotFailOnInvalidPartitionInSubscription(final boolean
withHeaders) {
+ final StreamsBuilder builder = new StreamsBuilder();
+ final KTable<Integer, String> left = builder.table(LEFT_TABLE,
Consumed.with(Serdes.Integer(), Serdes.String()));
+ final KTable<Integer, String> right = builder.table(RIGHT_TABLE,
Consumed.with(Serdes.Integer(), Serdes.String()));
+ left.join(
+ right,
+ value -> Integer.parseInt(value.split("\\|")[1]),
+ (value1, value2) -> "(" + value1 + "," + value2 + ")",
+ TableJoined.as("fk-join")
+ ).toStream().to(OUTPUT, Produced.with(Serdes.Integer(),
Serdes.String()));
+
+ try (final TopologyTestDriver driver =
createTopologyTestDriver(builder, withHeaders)) {
+ final TestInputTopic<Integer, String> leftInput =
driver.createInputTopic(LEFT_TABLE, new IntegerSerializer(), new
StringSerializer());
+ final TestInputTopic<Integer, String> rightInput =
driver.createInputTopic(RIGHT_TABLE, new IntegerSerializer(), new
StringSerializer());
+ final TestOutputTopic<Integer, String> output =
driver.createOutputTopic(OUTPUT, new IntegerDeserializer(), new
StringDeserializer());
+ final TestInputTopic<Integer, SubscriptionWrapper<Integer>>
subscriptionInput = driver.createInputTopic(
+ "test-app-fk-join-subscription-registration-topic",
+ new IntegerSerializer(),
+ new SubscriptionWrapperSerde<>(() -> "pk-pseudo-topic",
Serdes.Integer()).serializer()
+ );
+
+ rightInput.pipeInput(1, "rhsValue1");
+ leftInput.pipeInput(2, "lhsValue1|1");
+ assertEquals(Map.of(2, "(lhsValue1|1,rhsValue1)"),
output.readKeyValuesToMap());
+
+ subscriptionInput.pipeInput(1, new SubscriptionWrapper<>(
+ new long[] {1L, 2L},
Review Comment:
Agreed. I also checked the `withHeaders` cases: the value is serialized with
`StringSerializer`, which ignores headers, so the hash input is the same in
both cases.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]