[
https://issues.apache.org/jira/browse/BEAM-10123?focusedWorklogId=492719&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-492719
]
ASF GitHub Bot logged work on BEAM-10123:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 29/Sep/20 23:19
Start Date: 29/Sep/20 23:19
Worklog Time Spent: 10m
Work Description: boyuanzz commented on a change in pull request #12572:
URL: https://github.com/apache/beam/pull/12572#discussion_r497131119
##########
File path:
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaIO.java
##########
@@ -1620,14 +1635,43 @@ public void processElement(
CoderRegistry coderRegistry = input.getPipeline().getCoderRegistry();
Coder<K> keyCoder = getKeyCoder(coderRegistry);
Coder<V> valueCoder = getValueCoder(coderRegistry);
- Coder<KafkaRecord<K, V>> outputCoder = KafkaRecordCoder.of(keyCoder,
valueCoder);
- PCollection<KafkaRecord<K, V>> output =
- input.apply(ParDo.of(new ReadFromKafkaDoFn<K,
V>(this))).setCoder(outputCoder);
- // TODO(BEAM-10123): Add CommitOffsetTransform to expansion.
- if (isCommitOffsetEnabled() && !configuredKafkaCommit()) {
- throw new IllegalStateException("Offset committed is not supported
yet");
+ Coder<KafkaRecord<K, V>> recordCoder = KafkaRecordCoder.of(keyCoder,
valueCoder);
+
+ try {
+ PCollection<KV<KafkaSourceDescriptor, KafkaRecord<K, V>>>
outputWithDescriptor =
+ input
+ .apply(ParDo.of(new ReadFromKafkaDoFn<K, V>(this)))
+ .setCoder(
+ KvCoder.of(
+ input
+ .getPipeline()
+ .getSchemaRegistry()
+ .getSchemaCoder(KafkaSourceDescriptor.class),
+ recordCoder));
+ if (isCommitOffsetEnabled() && !configuredKafkaCommit()) {
+ outputWithDescriptor =
+ outputWithDescriptor
+ .apply(Reshuffle.viaRandomKey())
Review comment:
The `Reshuffle` is used as a persistent layer which help us to guarantee
that we will not re-read records priori to the committed offset.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 492719)
Time Spent: 1h 40m (was: 1.5h)
> Create CommitOffsetTransform to commit Kafka record offset
> ----------------------------------------------------------
>
> Key: BEAM-10123
> URL: https://issues.apache.org/jira/browse/BEAM-10123
> Project: Beam
> Issue Type: Sub-task
> Components: io-java-kafka
> Reporter: Boyuan Zhang
> Assignee: Boyuan Zhang
> Priority: P3
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)