Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the EventRead metadata along with a value #180

Closed
EronWright opened this issue Aug 7, 2018 · 1 comment · Fixed by #305
Closed

Expose the EventRead metadata along with a value #180

EronWright opened this issue Aug 7, 2018 · 1 comment · Fixed by #305

Comments

@EronWright
Copy link
Contributor

EronWright commented Aug 7, 2018

Problem description
Make it possible to create a FlinkPravegaReader that provides event metadata (e.g. EventPosition) for each event. This would facilitate the development of jobs that care about the stream position of the event data, e.g. for indexing purposes.

Suggestions for an improvement
Normally, the data stream that is produced is of type DataStream<T> to convey the deserialized event data of type T. To also convey metadata implies a data stream of type DataStream<EventRead<T>>. For example:

FlinkPravegaReader<EventRead<Double>> reader = ...;
DataStream<EventRead<Double>> datastream = env.addSource(reader);
datastream.map(e -> {
  assert e.isEvent();
  LOG.info("event: data={}, position={}", e.getEvent(), e.getEventPosition());
});

The EventRead class might not be ideal; we could introduce a similar type based on discussion.

One complication is that the DeserializationSchema<T> that is provided to the reader is typed to the event data type. Some cleverness in the builder would be needed to disambiguate the deserialized type <T> from the data stream type EventRead<T>. May also need to leverage Flink's OutputTypeConfigurable.

@crazyzhou crazyzhou self-assigned this Dec 11, 2019
@crazyzhou crazyzhou changed the title Expose the EventPosition metadata along with a value Expose the EventRead metadata along with a value Jan 6, 2020
@crazyzhou
Copy link
Contributor

The fix #305 is to provide a method deserializeWithMetadata for user to override that can leverage EventRead in the deserialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants