Merging rows of two streams with the same or different structures
It's a common requirement to combine two or more streams into a single stream that includes the union of all rows. In these cases, the streams come from different sources and don't always have the same structure. Consequently, combining the streams is not as easy as not just putting in a step that freely joins the streams. You have to take a couple of things into account. This recipe gives you the tips to make it easier.
Suppose that you received data about roller coasters from two different sources. The data in one of those sources looks like the following:
roller_coaster|speed|park|location|country|Year Top Thrill Dragster|120 mph|Cedar Point|Sandusky, Ohio||2003 Dodonpa|106.8 mph|Fuji-Q Highland|FujiYoshida-shi|Japan|2001 Steel Dragon 2000|95 mph|Nagashima Spa Land|Mie|Japan|2000 Millennium Force|93 mph|Cedar Point|Sandusky, Ohio||2000 Intimidator 305|90 mph|Kings Dominion|Doswell, Virginia||2010 Titan|85 mph|Six Flags Over...