IBMStreams / streamsx.topology

Develop streaming applications for IBM Streams in Python, Java & Scala.
http://ibmstreams.github.io/streamsx.topology
Apache License 2.0
29 stars 43 forks source link

Python: Provide Stream.punctor() #2517

Closed markheger closed 4 years ago

markheger commented 4 years ago

Support to emit Window punctuation like the SPL Punctor, but Python func is called to determine the condition when punct needs to be sent.

Stream.print() has a new parameter to print the punctuations to stdout.

topo = Topology()
s = topo.source([1,2,3,4])
s = s.punctor(lambda t : 2 < t)
s.print(write_punctuations=True)
markheger commented 4 years ago

merged to IBMStreams:feature/punct

markheger commented 4 years ago

Add an option that Punctor replaces a tuple by a window punctuation.

markheger commented 4 years ago
        topo = Topology()
        s = topo.source(generate_numbers_for_named_tuple_schema)
        s = s.punctor(func=(lambda t : True == t.punct_flag), replace=True)
        s = s.map(lambda x : (x.value,), schema='tuple<int32 z>')
        s.print(write_punctuations=True)
markheger commented 4 years ago

merged to develop branch for 1.16.0a