Hi Beam Community,

Our team has a number of PTransforms that are basically wrappers around 
MapElements, which give us a concise syntax when specifying pipelines which 
leverage shared map stages. One example that we are looking at currently is a 
function which takes JSON and maps it into ProtoBuf Message object using protos 
declarative type annotation to specify metadata about how to perform the 
transform. Our proto logic is a bit custom so it might not be suitable for 
upstreaming. Our current implementations of these mapper PTransforms are pretty 
simple ‘expand’ methods which perform the mapping and reduce code clutter on 
our pipeline code. We recently found that we may want to leverage some of the 
bells and whistles of MapElements when we use these PTransforms, such as ‘ 
exceptionsInto’ etc. It seems like a clean way to do this would be to subclass 
MapElements directly and just override the expand function, but MapElements has 
a private constructor and builders etc… Im wondering if there is an existing 
way to do this, or maybe if it would be useful to make the MapElements 
constructor protected? Feels like this would be a little funny since 
MapElements uses a builder etc. Curious if anyone has a way to do what we are 
trying to do here, or hear any other thoughts on this.

-Jason

Reply via email to