Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-3519

Refactor Transformer templates to return the same strong-typed value.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0.0
    • Fix Version/s: 0.10.0.0
    • Component/s: streams
    • Labels:

      Description

      Currently the Transformer interface's template is:

      R transform(K key, V value);
      

      While all its usage requires a key-value pair, and hence constructing the object as:

      new Transformer<K, V, KeyValue<K1, V1>>
      

      Since we expect Transformer to be only used in the Streams DSL, which is supposed to return another key-value pair streams, it's better to define its template just as

      public interface Transformer<K, V, K1, V1> {
      
          KeyValue<K1, V1> transform(K key, V value);
      }
      

      Also, we can allow punctuate() to also return a nullable KeyValue<K1, V1> pair, and let the implementation to forward to downstream processor only when the returned pair is not null.

        Attachments

          Activity

            People

            • Assignee:
              guozhang Guozhang Wang
              Reporter:
              guozhang Guozhang Wang
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: