lookup¶
Type of operation: Join
Description¶
Find matching rows in a dataset, retrieving fields and adding them to the output dataset as new columns.
The first argument of lookup must be either:
a join predicate in the form of
on(foo=@other.foo and bar=@other.bar ..)
, which defines what to look up by. The equality conditions in the predicate must follow one of the input datasets.an existing link in the form of
^linkLabel
(which already references another dataset).
The remaining arguments should be of the form name:@target.value, which define what values to retrieve from the target dataset that we are looking up.
Usage¶
lookup [ predicate_1, predicate_2, ... ], [ columnbinding_1, columnbinding_2, ... ]
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
predicate |
bool |
yes |
yes |
none |
columnbinding |
expression |
yes |
yes |
none |
Accelerable¶
lookup is always accelerable if the input is accelerable. A dataset that only uses accelerable verbs can be accelerated, making queries on the dataset respond faster.
Examples¶
lookup on([email protected] and [email protected]), hostname:@host.name, hostip:@host.ip
Using the values for ‘host_uid’ and ‘host_cluster’, look up the rows matching the same ‘uid’ and ‘cluster’ values in the input table named ‘host’. Extract the ‘name’ and ‘ip’ values from those ‘host’ dataset rows, using them populate new columns in the output called ‘hostname’ and ‘hostip’.
set_link "linkToClusterResource", [email protected]
lookup ^linkToClusterResource, clusterName:@Cluster.name
set_link "link to RDS Cluster", rdsClusterId=@"RDS Cluster".clusterId
lookup ^"link to RDS Cluster", clusterStatus:@"RDS Cluster".status
Create a link to the “Cluster” resource and use it to retrieve the cluster name.
Then, create another link called “link to RDS Cluster” (the link label can contain spaces) and use it with the lookup verb to retrieve the status of the cluster (due to the spaces in the name, the link label must be enclosed in double quotes when used).