KAFKA-16339: [1/4 KStream#transform] Remove Deprecated "transformer" methods and classes#17198
Conversation
|
I have missed removing the references to |
|
I have noticed that |
bafaa10 to
f28ac72
Compare
|
For now, I have removed the build with deduplicaiton topology test until we decide how to replace the |
|
I have replaced |
|
I have managed to fix the test! :D |
|
I have removed the references to |
| * Thus, an input record {@code <K,V>} can be transformed into an output record {@code <K':V'>}. | ||
| * This is a stateless record-by-record operation (cf. {@link #transform(TransformerSupplier, String...)} for | ||
| * stateful record transformation). | ||
| * This is a stateless record-by-record operation. |
There was a problem hiding this comment.
Yes, it think we should link to #process(...) here, instead of removing (same elsewhere where it make sense).
Btw: feel free to skip updating JavaDocs of other deprecated methods which will be remove in follow up PRs of this ticket.
| } | ||
|
|
||
| return KeyValue.pair(key, value); | ||
| store.put(key, value); |
There was a problem hiding this comment.
Similar to the return null replacement with delete. Since we would return a pair with key and value, now I put it in store.
| @ParameterizedTest | ||
| @MethodSource("data") | ||
| @SuppressWarnings("deprecation") | ||
| public void shouldPunctuateWithTimestampPreservedInProcessorContext(final boolean stateUpdaterEnabled, final boolean processingThreadsEnabled) { |
There was a problem hiding this comment.
I think we need to keep this test, but rewrite using #process().
|
|
||
| @nowarn | ||
| @Test | ||
| def shouldBuildIdenticalTopologyInJavaNScalaTransform(): Unit = { |
There was a problem hiding this comment.
Wondering if we have a test gap, as we don't have a similar test for process() -- should we add a new test for #process() like this one (or rewrite this test for #process())?
There was a problem hiding this comment.
I have rewritten this test with process, but have missed to rewrite the test name. I will fix it.
|
|
||
| @nowarn | ||
| @Test | ||
| def testTransformCorrectlyRecords(): Unit = { |
There was a problem hiding this comment.
Same question as above. Seems we are lacking a similar test for #process() ?
There was a problem hiding this comment.
Hm... I have replaced Transformer with ProcessorSupplier and transform with process. Have I missed something else?
| @nowarn | ||
| @Test | ||
| def testSettingNameOnTransform(): Unit = { | ||
| class TestTransformer extends Transformer[String, String, KeyValue[String, String]] { |
|
I will push some commits, one for each file from which I have removed the transform link, replacing it with process. |
35fd141 to
203f323
Compare
|
I have rebased my branch on trunk and this caused GitHub to close the PR. I am implementing the last review points again. |
|
This time, I have focused on removing the methods first and doing refactorings. After this, I will proceed with Javadoc updates. I have made the removing part. Now, I will do the refactoring part. |
mjsax
left a comment
There was a problem hiding this comment.
Thanks for updating the PR. LGTM.
Just triggered CI. Can merge after it finished and passed.
|
@fonsdant -- seems there is some compilation error: Seem we need to rewrite this test to use the new |
|
Thanks, @mjsax, still need to refactor it. Meanwhile, do you prefer that I convert this PR to draft? Or should I keep it as it is? |
|
We can keep this PR as-is -- you can also to the refactoring as part of this PR if you want. |
|
@fonsdant Any update on this PR? -- We are approaching AK 4.0 release deadlines, and there is 3 more PRs for this ticket... |
|
@mjsax, sorry for the delay, I am still refactoring the tests, replacing transform with process. Given the coming deadline, I agree it would be adequate someone more experienced to resume it. |
|
I will push the work I done this passed week. |
As long as you have enough time to keep working, I think we are a good. Of course, if you are blocked, let us know. |
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
46a01a6 to
7a65aed
Compare
| // | ||
| // val transformNode = builder.build().describe().subtopologies().asScala.head.nodes().asScala.toList(1) | ||
| // assertEquals("my-name", transformNode.name()) | ||
| // } |
There was a problem hiding this comment.
Should we rewrite this to testSettingNameOnProcess?
There was a problem hiding this comment.
Oh, sorry! I have missed it up. Of course, I will rewrite it!
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
|
@mjsax, I have removed the adding lines in buildTopologyWithDeduplication in StandbyTaskEOSIntegrationTest to match the previous implementation with transform (but still with process). Also, removed the comments of the KStreamTest scala test and rewritten it. Finally, removed var usage. |
mjsax
left a comment
There was a problem hiding this comment.
Thanks for the quick turn around. I think the Scala test can be simplified significantly. In the end, we only verify the name of he processor node in the Topology.
| @Test | ||
| def testSettingNameOnTransform(): Unit = { | ||
| val processorSupplier: ProcessorSupplier[String, String, String, String] = | ||
| new api.ProcessorSupplier[String, String, String, String] { |
There was a problem hiding this comment.
Why do we need an explicit ProcessorSupplier for this test? And we use process(() => new TestProcessor) similar to the old code?
There was a problem hiding this comment.
Not sure why IntelliJ shows an error... given that TestProcessor is api.Processor I would expect IntelliJ to figure out that the lambda is api.ProcessorSupplier and resolve to the new process(...) overload... In any case, the build did pass, so it seem ok. Also, the old process() will be removed soon, too: #17190
| def testSettingNameOnTransform(): Unit = { | ||
| val processorSupplier: ProcessorSupplier[String, String, String, String] = | ||
| new api.ProcessorSupplier[String, String, String, String] { | ||
| private val storeName = "store-name" |
| val processedKey = s"$key-processed" | ||
| val processedValue = s"$value-processed" | ||
| store.put(processedKey, processedValue) | ||
| context.forward(new api.Record(processedKey, processedValue, record.timestamp())) |
There was a problem hiding this comment.
What the Processor does is actually pretty meaningless for the test, so I think the while implementation could actually be empty? For this case, we don't even need init() method, as we don't need access to the context either.
Signed-off-by: Joao Pedro Fonseca Dantas <fonsdant@gmail.com>
|
Thanks, @mjsax! I have simplified the test and replaced the processorSupplier with a lambda. Should I replace it for for other methods too? And how about IntelliJ reporting it as problem? |
|
Merged to |
|
Uhuu! Here we go! I need to rebase the second one on this first now. Thanks, @mjsax! |
…methods and classes (apache#17198) Reviewers: Matthias J. Sax <matthias@confluent.io>
…methods and classes (apache#17198) Reviewers: Matthias J. Sax <matthias@confluent.io>


Hi, @mjsax! I have removed the
transformmethods from the main and test classes. However, I have asked myself whether the approach I have used forStandbyTaskEOSIntegrationTestandStreamThreadTestis correct. Should I replacetransformwithprocessas suggested intransformJavadoc or remove these tests? Thanks!