Last active
August 29, 2015 14:16
-
-
Save welch/457ebd655125d719f0bf to your computer and use it in GitHub Desktop.
Juttle: 4-way right outer join of a point stream of ids against tables of personal information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 4-way right outer join of a point stream of ids against tables of personal information. | |
// | |
// The points in the "tables" all have the same timestamp. | |
// For the join, the ID in each emitter point | |
// is matched against each table, and an output point is created that is the union of all | |
// matching points. This demonstrates partial joins when not all tables have an entry for | |
// an ID. There are no matches at all for ID 5, so that point is passed through unchanged. | |
//--------------------------------------------------------------------------- | |
const name = [ | |
{time:"1970-01-01T00:00:00.000Z", "id":1, "name":"fred"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":2, "name":"wilma"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":3, "name":"dino"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":4, "name":"barney"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":6, "name":"bambam"}, | |
]; | |
const haircolor = [ | |
{time:"1970-01-01T00:00:00.000Z", "id":1, "haircolor":"black"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":2, "haircolor":"orange"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":4, "haircolor":"blonde"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":6, "haircolor":"blonde"} | |
]; | |
const hobby = [ | |
{time:"1970-01-01T00:00:00.000Z", "id":1, "hobby":"bowling"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":3, "hobby":"singing"}, | |
{time:"1970-01-01T00:00:00.000Z", "id":6, "hobby":"home improvement"}, | |
]; | |
( demo ticker -points name events | |
; demo ticker -points haircolor events | |
; demo ticker -points hobby events | |
; emitter -start 0 -limit 6 | put id = count() | |
) | join -outer 4 id | remove time, type | @table |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment