Sdw:PASNQL - Join Command

From SensorDataLab

Jump to: navigation, search

Contents

Syntax

 node = join( parent_node1 | parent_node2, on => attr1, [ delta => D ]?, [ trigger => T ]?, [ window => { parent_node1 => B, parent_node2 => B } ]? );

Description

Joins data coming from two parent nodes.

Details

The join command performs a cross product on the data coming from the given parent nodes and then selects the tuples that conform to the given join predicate. The join predicate consists of the join attribute (specified by on) and an optional delta value. The join attribute specifies which attribute should match in both parent nodes in order for it to be selected. When specifying this attribute without the delta parameter, the join only selects when there is an exact match. Otherwise, a difference between two values of size D is considered a match as well. The delta D can be a number or a time value, which is the case when a letter is appended to the number (allowed letters are ʻsʼ, ʻmʼ and ʻhʼ). Consider the following cases:

D = 4
Two values match when the difference is no greater than 4.
D = 1.5
Two values match when the difference is no greater than 1.5.
D = 3s
Two values match when the difference is no greater than three seconds.
D = 5m
Two values match when the difference is no greater than five minutes.
D = 1h
Two values match when the difference is no greater than one hour.
D = 7.5s
Two values match when the difference is no greater than seven and a half seconds.

Examples

  • join1 = join( dummy1 | source1, on => source_id );
  • join2 = join( dummy1 | source1, on => value, delta => 2 );
  • join2 = join( dummy1 | source1, on => timed, delta => 5s );
  • join3 = join( dummy1 | source1, on => timed, delta => 1m, window => { dummy1 => [ MAX_ID - 5 .. MAX_ID ], source1 => ( MAX_ID - 10 .. MAX_ID ] }, trigger => LAST < MAX_SID - 20 );
Personal tools