-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for infinite loop replication (#481)
* Add test for infinite loop replication Signed-off-by: Daniel Henneberger <git@danielhenneberger.com> * Enable test Signed-off-by: Daniel Henneberger <git@danielhenneberger.com> * Slim down example Signed-off-by: Daniel Henneberger <git@danielhenneberger.com> --------- Signed-off-by: Daniel Henneberger <git@danielhenneberger.com>
- Loading branch information
1 parent
07c8b74
commit ec5ea02
Showing
9 changed files
with
138 additions
and
0 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
8 changes: 8 additions & 0 deletions
8
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard.graphqls
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,8 @@ | ||
type Query { | ||
CustomerSpending(customerid: Int!, fromTime: String!, toTime: String!, limit: Int = 10, offset: Int = 0): [CustomerSpending!] | ||
} | ||
|
||
type CustomerSpending { | ||
category: String! | ||
spending: Float! | ||
} |
19 changes: 19 additions & 0 deletions
19
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard.sqrl
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,19 @@ | ||
IMPORT creditcard.Merchant; | ||
IMPORT creditcard.Assignment AS CardAssignment; | ||
IMPORT creditcard.Transaction; | ||
IMPORT time.*; | ||
|
||
Merchant := DISTINCT Merchant ON merchantId ORDER BY updatedTime DESC; | ||
CardAssignment := DISTINCT CardAssignment ON cardNo ORDER BY timestamp DESC; | ||
|
||
CustomerSpendingByDay := SELECT customerid, endOfDay(time) as timeDay, category, SUM(amount) as spending | ||
FROM Transaction t | ||
JOIN CardAssignment c ON t.cardNo = c.cardNo | ||
JOIN Merchant m ON t.merchantId = m.merchantid | ||
GROUP BY customerid, timeDay, category; | ||
|
||
CustomerSpending(@customerid: BIGINT, @fromTime: TIMESTAMP, @toTime: TIMESTAMP) := | ||
SELECT category, SUM(spending) as spending | ||
FROM CustomerSpendingByDay WHERE customerid = @customerid AND @fromTime <= timeDay AND @toTime > timeDay | ||
GROUP BY category ORDER BY category ASC; | ||
|
17 changes: 17 additions & 0 deletions
17
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/assignment.schema.yml
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,17 @@ | ||
--- | ||
name: "assignment" | ||
schema_version: "1" | ||
partial_schema: false | ||
columns: | ||
- name: "customerId" | ||
type: "BIGINT" | ||
tests: | ||
- "not_null" | ||
- name: "cardNo" | ||
type: "STRING" | ||
tests: | ||
- "not_null" | ||
- name: "timestamp" | ||
type: "TIMESTAMP" | ||
tests: | ||
- "not_null" |
13 changes: 13 additions & 0 deletions
13
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/assignment.table.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,13 @@ | ||
{ | ||
"format" : { | ||
"name" : "json" | ||
}, | ||
"schema" : "flexible", | ||
"identifier" : "assignment", | ||
"type" : "source", | ||
"connector" : { | ||
"name" : "file", | ||
"directoryURI" : "../../sqrl-examples/creditcard/data" | ||
}, | ||
"canonicalizer" : "system" | ||
} |
21 changes: 21 additions & 0 deletions
21
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/merchant.schema.yml
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,21 @@ | ||
--- | ||
name: "merchant" | ||
schema_version: "1" | ||
partial_schema: false | ||
columns: | ||
- name: "merchantId" | ||
type: "BIGINT" | ||
tests: | ||
- "not_null" | ||
- name: "name" | ||
type: "STRING" | ||
tests: | ||
- "not_null" | ||
- name: "category" | ||
type: "STRING" | ||
tests: | ||
- "not_null" | ||
- name: "updatedTime" | ||
type: "TIMESTAMP" | ||
tests: | ||
- "not_null" |
13 changes: 13 additions & 0 deletions
13
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/merchant.table.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,13 @@ | ||
{ | ||
"format" : { | ||
"name" : "json" | ||
}, | ||
"schema" : "flexible", | ||
"identifier" : "merchant", | ||
"type" : "source", | ||
"connector" : { | ||
"name" : "file", | ||
"directoryURI" : "../../sqrl-examples/creditcard/data" | ||
}, | ||
"canonicalizer" : "system" | ||
} |
25 changes: 25 additions & 0 deletions
25
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/transaction.schema.yml
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,25 @@ | ||
--- | ||
name: "transaction" | ||
schema_version: "1" | ||
partial_schema: false | ||
columns: | ||
- name: "transactionId" | ||
type: "BIGINT" | ||
tests: | ||
- "not_null" | ||
- name: "cardNo" | ||
type: "STRING" | ||
tests: | ||
- "not_null" | ||
- name: "time" | ||
type: "TIMESTAMP" | ||
tests: | ||
- "not_null" | ||
- name: "amount" | ||
type: "DOUBLE" | ||
tests: | ||
- "not_null" | ||
- name: "merchantId" | ||
type: "BIGINT" | ||
tests: | ||
- "not_null" |
13 changes: 13 additions & 0 deletions
13
sqrl-tools/sqrl-cli/src/test/resources/creditcard/creditcard/transaction.table.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,13 @@ | ||
{ | ||
"format" : { | ||
"name" : "json" | ||
}, | ||
"schema" : "flexible", | ||
"identifier" : "transaction", | ||
"type" : "source", | ||
"connector" : { | ||
"name" : "file", | ||
"directoryURI" : "../../sqrl-examples/creditcard/data" | ||
}, | ||
"canonicalizer" : "system" | ||
} |