[ 
https://issues.apache.org/jira/browse/KAFKA-3338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15222135#comment-15222135
 ] 

Guozhang Wang commented on KAFKA-3338:
--------------------------------------

[~bbejeck] I think we can overload the print / etc functions with and without 
the serdes. For the examples you gave, both the "stocks-out" resulted stream 
and the aggregated "stock-summaries" stream actually already carries their 
serdes from the previous operation, and hence in this case users can just call 
print() without needing to give the serde; in other cases like your mapped 
stream above, since in Java we cannot perfectly infer the data types then users 
may need to provide the serde.

In terms of implementation, we can try to use the default serde if it is not 
overridden (i.e. specified by user) in the print function and there is not one 
carried over from the previous operation, and throw a meaningful runtime 
exception if the data types does not match (instead of just a 
ClassCastException).

It is related to this ticket as well: 
https://issues.apache.org/jira/browse/KAFKA-3429

Thoughts?

> Add print and writeAsText functions to the Streams DSL
> ------------------------------------------------------
>
>                 Key: KAFKA-3338
>                 URL: https://issues.apache.org/jira/browse/KAFKA-3338
>             Project: Kafka
>          Issue Type: Sub-task
>            Reporter: Guozhang Wang
>            Assignee: Bill Bejeck
>              Labels: newbie++
>             Fix For: 0.10.1.0
>
>
> We want to provide some REPL-like pattern for users for better debuggability. 
> More concretely, we want to allow users to easily inspect their intermediate 
> data streams in the topology while running the application. Theoretically 
> this can be done by using a break point, or by calling System.out.println() 
> inside the operator, or through a finer grained trace-level logging. But more 
> user-friendly API would be to add a print() function to the KStream / KTable 
> object like:
> {code}
> // Prints the elements in this stream to the stdout, i.e. "System.out" of the 
> JVM
> KStream#print(/* optional serde */);  
> KTable#print(/* optional serde */);  
> // Writes the stream as text file(s) to the specified location.
> KStream#writeAsText(String filePath, /* optional serde */);
> KTable#writeAsText(String filePath, /* optional serde */);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to