-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
315 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.5.0 | ||
2.6.0 |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
### Data aggregation with side input with yaml rule | ||
|
||
### Scenario: | ||
|
||
This scenario test data aggregation with side input. | ||
|
||
It uses the following rule: | ||
|
||
[@rule.json](rule/performance.yaml) | ||
```yaml | ||
- When: | ||
Prefix: "/data/case022" | ||
Suffix: ".json" | ||
Async: true | ||
Batch: | ||
Window: | ||
DurationInSec: 10 | ||
Dest: | ||
Table: bqtail.transactions | ||
Transient: | ||
Dataset: temp | ||
tAlias: t | ||
Transform: | ||
charge: (CASE WHEN type_id = 1 THEN t.payment + f.value WHEN type_id = 2 THEN t.payment * (1 + f.value) END) | ||
SideInputs: | ||
- Table: bqtail.fees | ||
Alias: f | ||
'On': t.fee_id = f.id | ||
OnSuccess: | ||
- Action: query | ||
Request: | ||
SQL: SELECT | ||
DATE(timestamp) AS date, | ||
sku_id, | ||
supply_entity_id, | ||
MAX($EventID) AS batch_id, | ||
SUM( payment) payment, | ||
SUM((CASE WHEN type_id = 1 THEN t.payment + f.value WHEN type_id = 2 THEN t.payment * (1 + f.value) END)) charge, | ||
SUM(COALESCE(qty, 1.0)) AS qty | ||
FROM $TempTable t | ||
LEFT JOIN bqtail.fees f ON f.id = t.fee_id | ||
GROUP BY 1, 2, 3 | ||
Dest: bqtail.supply_performance | ||
Append: true | ||
OnSuccess: | ||
- Action: delete | ||
``` | ||
Note that storage trigger $EventID is used as batch id. | ||
7 changes: 7 additions & 0 deletions
7
e2e/regression/cases/046_multi_step/bqtail/expect/supply_performance_v${parentIndex}.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{"@indexBy@": ["sku_id", "supply_entity_id"]}, | ||
{"date":"$FormatTime('2daysAgo','yyyy-MM-dd')","sku_id":"86622","supply_entity_id":"22012","payment":102.7,"qty":1,"charge":128.375}, | ||
{"date":"$FormatTime('2daysAgo','yyyy-MM-dd')","sku_id":"50623","supply_entity_id":"22010","payment":30.4,"qty":2,"charge":32.4}, | ||
{"date":"$FormatTime('1daysAgo','yyyy-MM-dd')","sku_id":"86621","supply_entity_id":"22010","payment":56.31,"qty":1,"charge":70.3875}, | ||
{"date":"$FormatTime('2daysAgo','yyyy-MM-dd')","sku_id":"10023","supply_entity_id":"22012","payment":64.4,"qty":2,"charge":66.4} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{}, | ||
{"id": 1, "type_id": 1, "value": 1}, | ||
{"id": 2, "type_id": 2, "value": 0.25} | ||
] |
3 changes: 3 additions & 0 deletions
3
e2e/regression/cases/046_multi_step/bqtail/prepare/supply_performance_v${parentIndex}.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
{} | ||
] |
3 changes: 3 additions & 0 deletions
3
e2e/regression/cases/046_multi_step/bqtail/prepare/transactions_v${parentIndex}.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
{} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
|
||
CREATE OR REPLACE TABLE transactions_v${parentIndex} ( | ||
id STRING, | ||
timestamp TIMESTAMP, | ||
batch_id INT64, | ||
event_id INT64, | ||
sku_id INT64, | ||
supply_entity_id INT64, | ||
payment FLOAT64, | ||
demany_entity_id INT64, | ||
charge FLOAT64, | ||
qty FLOAT64, | ||
fee_id INT64 | ||
); | ||
|
||
|
||
CREATE OR REPLACE TABLE fees ( | ||
id INT64, | ||
type_id INT64, | ||
value FLOAT64 | ||
); | ||
|
||
|
||
CREATE OR REPLACE TABLE supply_performance_v${parentIndex} ( | ||
date DATE, | ||
batch_id INT64, | ||
sku_id INT64, | ||
supply_entity_id INT64, | ||
payment FLOAT64, | ||
qty FLOAT64, | ||
charge FLOAT64 | ||
) PARTITION BY date CLUSTER BY supply_entity_id, sku_id; | ||
|
6 changes: 6 additions & 0 deletions
6
e2e/regression/cases/046_multi_step/data/trigger/transactions.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ "id":"A8B0492A-330D-48A2-A18F-78BF42EECFF", "timestamp": "$FormatTime('2daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 101, "sku_id": 10023, "supply_entity_id": 22012, "payment": 32.2, "demany_entity_id":332421, "fee_id": 1} | ||
{ "id":"021C1141-1342-4243-BFF8-3DCD0F0732A8", "timestamp": "$FormatTime('2daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 102, "sku_id": 50623, "supply_entity_id": 22010, "payment": 15.2, "demany_entity_id":332421, "fee_id": 1} | ||
{ "id":"46CAC8F6-6F15-4A94-B0B1-D97C18A05F2F", "timestamp": "$FormatTime('2daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 101, "sku_id": 10023, "supply_entity_id": 22012, "payment": 32.2, "demany_entity_id":632438, "fee_id": 1 } | ||
{ "id":"6D50CC7E-1944-489A-AFE4-CD8FEE58A33C", "timestamp": "$FormatTime('2daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 102, "sku_id": 50623, "supply_entity_id": 22010, "payment": 15.2, "demany_entity_id":632438, "fee_id": 1 } | ||
{ "id":"337059BF-7494-4697-8CC3-46F960D77834", "timestamp": "$FormatTime('2daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 101, "sku_id": 86622, "supply_entity_id": 22012, "payment":102.7, "demany_entity_id":332421, "fee_id": 2 } | ||
{ "id":"C9260B5E-DEED-4934-880E-A81077C5A6BD", "timestamp": "$FormatTime('1daysAgo','yyyy-MM-dd hh:mm:ss')", "event_id": 102, "sku_id": 86621, "supply_entity_id": 22010, "payment": 56.31, "demany_entity_id":632438, "fee_id": 2} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
data aggregation with side input |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
When: | ||
Prefix: "/data/supply_performance" | ||
Suffix: ".avro" | ||
Async: true | ||
Batch: | ||
Window: | ||
DurationInSec: 10 | ||
Dest: | ||
Table: bqtail.supply_performance_v${parentIndex} | ||
OnSuccess: | ||
- Action: delete |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
When: | ||
Prefix: "/data/case${parentIndex}" | ||
Suffix: ".json" | ||
Async: true | ||
Batch: | ||
Window: | ||
DurationInSec: 10 | ||
Dest: | ||
Table: bqtail.transactions_v${parentIndex} | ||
Transient: | ||
Dataset: temp | ||
Alias: t | ||
Transform: | ||
charge: (CASE WHEN type_id = 1 THEN t.payment + f.value WHEN type_id = 2 THEN t.payment * (1 + f.value) END) | ||
SideInputs: | ||
- Table: bqtail.fees | ||
Alias: f | ||
'On': t.fee_id = f.id | ||
OnSuccess: | ||
- Action: query | ||
Request: | ||
SQL: SELECT | ||
DATE(timestamp) AS date, | ||
sku_id, | ||
supply_entity_id, | ||
MAX($EventID) AS batch_id, | ||
SUM( payment) payment, | ||
SUM((CASE WHEN type_id = 1 THEN t.payment + f.value WHEN type_id = 2 THEN t.payment * (1 + f.value) END)) charge, | ||
SUM(COALESCE(qty, 1.0)) AS qty | ||
FROM $TempTable t | ||
LEFT JOIN bqtail.fees f ON f.id = t.fee_id | ||
GROUP BY 1, 2, 3 | ||
Dest: ${ProjectID}.temp.supply_performance_v${EventID} | ||
Append: false | ||
OnSuccess: | ||
- Action: export | ||
Request: | ||
Source: ${ProjectID}.temp.supply_performance_v${EventID} | ||
DestURL: gs://${TriggerBucket}/data/supply_performance/transient-*.avro | ||
Format: AVRO | ||
UseAvroLogicalTypes: true | ||
OnSuccess: | ||
- Action: delete | ||
- Action: drop | ||
Request: | ||
Table: ${ProjectID}.temp.supply_performance_v${EventID} |
Oops, something went wrong.