You need to enable JavaScript to run this app.
Torch Log Service

Torch Log Service

Copy page
Download PDF
Alarm policy
Multi-statement set operation
Copy page
Download PDF
Multi-statement set operation
A TLS alert monitoring task treats a query and analysis result as a set and supports associating up to three sets for monitoring.​
Notice​
  • The monitoring task selects up to the first 1,000 rows of data from the set operation results to trigger alerts.​
  • When monitoring three sets, the task selects up to the first 100 rows from each query and analysis result for set operations. It performs operations on the first two sets, and then combines the results with the third set for further set operations.​
How it works​
A TLS alert monitoring task treats a query and analysis result as a set, and supports connecting multiple sets using Cartesian product, left join, and right join methods to create a result set for alert triggering.​
​
Set operation​
Diagram​
Description​
Cartesian product​
​​​
Pair each row of data to generate a result set with a size equal to the product of the row counts.​
Do not merge​
​​​
Only use the first data item for query and analysis.​
The second data can only be referenced in variable fields within content templates.​
Union​
​​​
Merge columns from different tables into one table. The merged column will be named OriginalDataSourceName.​
Left join​
​​​
Match data using specified columns (such as id). If a row from the left table does not have a match in the right table, the right table fields for that row will display null in the result set.​
Right join​
​​​
Match data using specified columns (such as id). If a row from the right table does not have a match in the left table, the left table fields for that row will display null in the result set.​
Inner join​
​​​
Match data using specified columns (such as id), and only keep intersecting rows.​
Full join​
​​​
Match data using specified columns (such as id) and keep all rows.​
Left anti join​
​​​
Remove data from the left data source that exists in the right data source, which means that the right data source serves as a denylist for the left data source.​
Right anti join​
​​​
Remove data from the right data source that exists in the left data source, which means that the left data source serves as a denylist for the right data source.​
​
Example of set operation​
Statement configuration​
The following statements are for demonstration purposes only.​
  • 1 execution statement​
  • ​
    | SELECT uid,region​
    ​
  • 2 execution statements​
  • ​
    | SELECT uid,region,COUNT(*) AS total GROUP BY uid,region​
    ​
  • Set operations: See examples for each type of set operation.​
Execution statement result​
The following execution results are provided as examples only.​
  • The result of 1 execution statement​
  • ​
    uid​
    region​
    10001​
    beijing​
    10002​
    shanghai​
    10003​
    guangzhou​
    ​
  • The result of 2 execution statements​
  • ​
    uid​
    region​
    total​
    10001​
    beijing​
    18​
    10002​
    shanghai​
    20​
    10004​
    shenzhen​
    19​
    ​
Result of set operation on execution statements​
Cartesian product result​
  • ​
    $1.uid​
    $1.region​
    $2.uid​
    $2.region​
    $2.total​
    10001​
    beijing​
    10001​
    beijing​
    18​
    10001​
    beijing​
    10002​
    shanghai​
    20​
    10001​
    beijing​
    10004​
    shenzhen​
    19​
    10002​
    shanghai​
    10001​
    beijing​
    18​
    10002​
    shanghai​
    10002​
    shanghai​
    20​
    10002​
    shanghai​
    10004​
    shenzhen​
    19​
    10003​
    guangzhou​
    10001​
    beijing​
    18​
    10003​
    guangzhou​
    10002​
    shanghai​
    20​
    10003​
    guangzhou​
    10004​
    shenzhen​
    19​
    ​
No merge result​
  • ​
    $1.uid​
    $1.region​
    10001​
    beijing​
    10002​
    shanghai​
    10003​
    guangzhou​
    ​
Merge result​
  • ​
    $1.uid​
    $1.region​
    $2.uid​
    $2.region​
    $2.total​
    10001​
    beijing​
    10001​
    beijing​
    18​
    10002​
    shanghai​
    10002​
    shanghai​
    20​
    10003​
    guangzhou​
    /​
    /​
    /​
    /​
    /​
    10004​
    shenzhen​
    19​
    ​
Inner join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $1.uid/$2.uid​
    $1.region​
    $2.region​
    $2.total​
    10001​
    beijing​
    beijing​
    18​
    10002​
    shanghai​
    shanghai​
    20​
    ​
Full join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $1.uid/$2.uid​
    $1.region​
    $2.region​
    $2.total​
    10001​
    beijing​
    beijing​
    18​
    10002​
    shanghai​
    shanghai​
    20​
    10003​
    guangzhou​
    /​
    /​
    10004​
    /​
    shenzhen​
    19​
    ​
Left join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $1.uid​
    $1.region​
    $2.region​
    $2.total​
    10001​
    beijing​
    beijing​
    18​
    10002​
    shanghai​
    shanghai​
    20​
    10003​
    guangzhou​
    null​
    null​
    ​
Right join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $2.uid​
    $1.region​
    $2.region​
    $2.total​
    10001​
    beijing​
    beijing​
    18​
    10002​
    shanghai​
    shanghai​
    20​
    10004​
    null​
    shenzhen​
    19​
    ​
Left anti join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $1.uid​
    $1.region​
    10003​
    guangzhou​
    ​
Right anti join result​
  • Set operation: condition is $1.uid==$2.uid​
  • ​
    $2.uid​
    $2.region​
    $2.total​
    10004​
    shenzhen​
    19​
    ​
​
Last updated: 2026.03.31 11:32:38