Skip to content

Commit

Permalink
Run Atlas example with 200 + 200 records
Browse files Browse the repository at this point in the history
  • Loading branch information
fkettelhoit committed Aug 21, 2024
1 parent 30ebeaa commit 7bc3bab
Show file tree
Hide file tree
Showing 8 changed files with 482 additions and 88 deletions.
27 changes: 21 additions & 6 deletions examples/sql-integration/.example.garble.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@ const ROWS_0: usize = PARTY_0::ROWS;
const ROWS_1: usize = PARTY_1::ROWS;
const ID_LEN: usize = max(PARTY_0::ID_LEN, PARTY_1::ID_LEN);

enum ScreeningStatus {
Recent,
OutOfDate,
Missing,
}

pub fn main(
missing_screenings: [([u8; ID_LEN]); ROWS_0],
special_educational_needs: [([u8; ID_LEN]); ROWS_1],
screenings: [([u8; ID_LEN], ScreeningStatus); ROWS_0],
school_examinations: [([u8; ID_LEN], u8); ROWS_1],
) -> [(u16, u16); 1] {
let mut joined = 0u16;
let mut missing_screenings_with_special_ed_needs = 0u16;
let mut total = ROWS_1 as u16;
for _ in join(missing_screenings, special_educational_needs) {
joined = joined + 1u16;
for joined in join(screenings, school_examinations) {
let ((_, screening), (_, special_ed_needs)) = joined;
if special_ed_needs <= 2u8 {
match screening {
ScreeningStatus::Missing => {
missing_screenings_with_special_ed_needs =
missing_screenings_with_special_ed_needs + 1u16;
}
_ => {}
}
}
}
[(joined, total)]
[(missing_screenings_with_special_ed_needs, total)]
}
6 changes: 3 additions & 3 deletions examples/sql-integration/policies0.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
"program": ".example.garble.rs",
"leader": 0,
"party": 0,
"input": "SELECT first_name || last_name || date_of_birth FROM early_detection_screening WHERE screening_status = 'missing'",
"input": "SELECT first_name || last_name || date_of_birth, screening_status FROM early_detection_screening",
"input_db": "postgres://postgres:test@localhost:5550/postgres",
"setup": "TRUNCATE results",
"output": "INSERT INTO results (joined, total) VALUES (CAST($1 AS INT), CAST($2 AS INT))",
"output_db": "postgres://postgres:test@localhost:5555/postgres",
"constants": {
"ROWS": {
"query": "SELECT COUNT(id) FROM early_detection_screening WHERE screening_status = 'missing'",
"query": "SELECT COUNT(id) FROM early_detection_screening",
"ty": "usize"
},
"ID_LEN": {
"query": "SELECT MAX(LENGTH(first_name || last_name || date_of_birth)) FROM early_detection_screening WHERE screening_status = 'missing'",
"query": "SELECT MAX(LENGTH(first_name || last_name || date_of_birth)) FROM early_detection_screening",
"ty": "usize"
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/sql-integration/policies1.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"program": ".example.garble.rs",
"leader": 0,
"party": 1,
"input": "SELECT CONCAT(first_name, last_name, date_of_birth) FROM school_entry_examination WHERE special_educational_needs = 1",
"input": "SELECT CONCAT(first_name, last_name, date_of_birth), special_educational_needs FROM school_entry_examination",
"input_db": "mysql://root:test@localhost:5551/test",
"constants": {
"ROWS": {
"query": "SELECT COUNT(id) FROM school_entry_examination WHERE special_educational_needs = 1",
"query": "SELECT COUNT(id) FROM school_entry_examination",
"ty": "usize"
},
"ID_LEN": {
"query": "SELECT MAX(LENGTH(CONCAT(first_name, last_name, date_of_birth))) FROM school_entry_examination WHERE special_educational_needs = true",
"query": "SELECT MAX(LENGTH(CONCAT(first_name, last_name, date_of_birth))) FROM school_entry_examination",
"ty": "usize"
}
}
Expand Down
235 changes: 200 additions & 35 deletions examples/sql-integration/seeds/db0/early_detection_screening.csv
Original file line number Diff line number Diff line change
@@ -1,36 +1,201 @@
id,first_name,last_name,date_of_birth,screening_status
0,"Alice","A","01/01/2010","missing"
1,"Bob","B","01/01/2010","missing"
2,"Carol","C","01/01/2010","missing"
3,"Carlos","C","01/01/2010","missing"
4,"Charlie","C","01/01/2010","missing"
5,"Chuck","C","01/01/2010","missing"
6,"Chad","C","01/01/2010","missing"
7,"Craig","C","01/01/2010","missing"
8,"Dan","D","01/01/2010","missing"
9,"Dave","D","01/01/2010","missing"
10,"David","D","01/01/2010","missing"
11,"Erin","E","01/01/2010","missing"
12,"Eve","E","01/01/2010","missing"
13,"Faythe","F","01/01/2010","missing"
14,"Frank","F","01/01/2010","missing"
15,"Grace","G","01/01/2010","missing"
16,"Heidi","H","01/01/2010","missing"
17,"Ivan","I","01/01/2010","missing"
18,"Judy","J","01/01/2010","missing"
19,"Mallory","M","01/01/2010","missing"
20,"Michael","M","01/01/2010","missing"
21,"Mike","M","01/01/2010","missing"
22,"Niaj","N","01/01/2010","missing"
23,"Olivia","O","01/01/2010","missing"
24,"Oscar","O","01/01/2010","missing"
25,"Peggy","P","01/01/2010","missing"
26,"Pat","P","01/01/2010","missing"
27,"Rupert","R","01/01/2010","missing"
28,"Sybil","S","01/01/2010","missing"
29,"Trent","T","01/01/2010","missing"
30,"Ted","T","01/01/2010","missing"
31,"Trudy","T","01/01/2010","missing"
32,"Victor","V","01/01/2010","missing"
33,"Walter","W","01/01/2010","missing"
34,"Wendy","W","01/01/2010","missing"
0,"Victor","Hughes","08/17/2011","missing"
1,"Alice","Smith","01/01/2010","recent"
2,"Bob","Johnson","02/14/2009","missing"
3,"Charlie","Williams","03/03/2008","recent"
4,"David","Brown","04/22/2007","outofdate"
5,"Eve","Jones","05/15/2012","missing"
6,"Frank","Garcia","06/20/2011","recent"
7,"Grace","Miller","07/07/2006","missing"
8,"Hannah","Davis","08/08/2005","recent"
9,"Ivy","Martinez","09/09/2013","missing"
10,"Jack","Taylor","10/10/2004","outofdate"
11,"Kevin","Thomas","11/11/2010","recent"
12,"Liam","Moore","12/12/2009","missing"
13,"Mia","Anderson","01/13/2012","missing"
14,"Nina","Jackson","02/14/2008","outofdate"
15,"Oscar","White","03/15/2006","recent"
16,"Paul","Harris","04/16/2005","recent"
17,"Quinn","Martin","05/17/2004","missing"
18,"Ruby","Thompson","06/18/2013","missing"
19,"Sara","Garcia","07/19/2012","recent"
20,"Tom","Martinez","08/20/2011","outofdate"
21,"Uma","Robinson","09/21/2010","missing"
22,"Vera","Clark","10/22/2009","recent"
23,"Will","Rodriguez","11/23/2008","missing"
24,"Xander","Lewis","12/24/2007","outofdate"
25,"Yara","Lee","01/25/2006","missing"
26,"Zane","Walker","02/26/2005","recent"
27,"Ava","Hall","03/27/2014","recent"
28,"Ben","Allen","04/28/2013","outofdate"
29,"Cara","Young","05/29/2012","recent"
30,"Drew","King","06/30/2011","missing"
31,"Ella","Wright","07/31/2010","recent"
32,"Finn","Scott","08/01/2009","missing"
33,"Gina","Green","09/02/2008","outofdate"
34,"Hugo","Adams","10/03/2007","recent"
35,"Iris","Baker","11/04/2006","missing"
36,"Jake","Gonzalez","12/05/2005","recent"
37,"Kara","Nelson","01/06/2014","recent"
38,"Luca","Carter","02/07/2013","missing"
39,"Maya","Mitchell","03/08/2012","outofdate"
40,"Noah","Perez","04/09/2011","recent"
41,"Olive","Roberts","05/10/2010","missing"
42,"Piper","Turner","06/11/2009","recent"
43,"Quincy","Phillips","07/12/2008","outofdate"
44,"Rosa","Campbell","08/13/2007","missing"
45,"Sam","Parker","09/14/2006","recent"
46,"Tina","Evans","10/15/2005","missing"
47,"Ulysses","Edwards","11/16/2014","outofdate"
48,"Violet","Collins","12/17/2013","recent"
49,"Wes","Stewart","01/18/2012","recent"
50,"Xena","Sanchez","02/19/2011","outofdate"
51,"Yasmin","Morris","03/20/2010","missing"
52,"Zach","Rogers","04/21/2009","missing"
53,"Amelia","Reed","05/22/2008","recent"
54,"Brandon","Cook","06/23/2007","outofdate"
55,"Clara","Morgan","07/24/2006","missing"
56,"Dylan","Bell","08/25/2005","recent"
57,"Ella","Murphy","09/26/2014","outofdate"
58,"Finn","Bailey","10/27/2013","recent"
59,"Grace","Rivera","11/28/2012","missing"
60,"Hank","Cooper","12/29/2011","missing"
61,"Ivy","Richardson","01/30/2010","recent"
62,"Jack","Cox","02/01/2009","recent"
63,"Kylie","Howard","03/02/2008","missing"
64,"Liam","Ward","04/03/2007","outofdate"
65,"Mia","Torres","05/04/2006","missing"
66,"Nate","Peterson","06/05/2005","recent"
67,"Olivia","Gray","07/06/2014","recent"
68,"Paul","Ramirez","08/07/2013","missing"
69,"Quinn","James","09/08/2012","outofdate"
70,"Ruby","Watson","10/09/2011","missing"
71,"Sam","Brooks","11/10/2010","recent"
72,"Tina","Kelly","12/11/2009","missing"
73,"Uma","Sanders","01/12/2008","missing"
74,"Victor","Price","02/13/2007","recent"
75,"Willow","Bennett","03/14/2006","recent"
76,"Xavier","Wood","04/15/2005","missing"
77,"Yara","Barnes","05/16/2014","outofdate"
78,"Zane","Ross","06/17/2013","recent"
79,"Alice","Henderson","07/18/2012","missing"
80,"Ben","Coleman","08/19/2011","outofdate"
81,"Cara","Jenkins","09/20/2010","recent"
82,"Drew","Perry","10/21/2009","recent"
83,"Ella","Powell","11/22/2008","missing"
84,"Finn","Long","12/23/2007","missing"
85,"Gina","Patterson","01/24/2006","outofdate"
86,"Hugo","Hughes","02/25/2005","recent"
87,"Iris","Flores","03/26/2014","recent"
88,"Jake","Washington","04/27/2013","missing"
89,"Kara","Butler","05/28/2012","outofdate"
90,"Luca","Simmons","06/29/2011","missing"
91,"Maya","Foster","07/30/2010","recent"
92,"Noah","Gonzales","08/31/2009","recent"
93,"Olive","Bryant","09/01/2008","missing"
94,"Piper","Alexander","10/02/2007","missing"
95,"Quincy","Russell","11/03/2006","outofdate"
96,"Rosa","Griffin","12/04/2005","recent"
97,"Sam","Diaz","01/05/2014","recent"
98,"Tina","Hayes","02/06/2013","missing"
99,"Ulysses","Myers","03/07/2012","missing"
100,"Violet","Ford","04/08/2011","recent"
101,"Adam","Nguyen","05/09/2010","missing"
102,"Bridget","Peterson","06/10/2009","outofdate"
103,"Cody","Flores","07/11/2008","missing"
104,"Daisy","Ramirez","08/12/2007","recent"
105,"Ethan","Howard","09/13/2006","recent"
106,"Faith","Long","10/14/2005","missing"
107,"George","Bennett","11/15/2014","missing"
108,"Hailey","Baker","12/16/2013","recent"
109,"Ian","Davis","01/17/2012","outofdate"
110,"Julia","Torres","02/18/2011","recent"
111,"Kyle","Cooper","03/19/2010","recent"
112,"Leah","Gray","04/20/2009","missing"
113,"Mason","Jenkins","05/21/2008","missing"
114,"Nora","Sanders","06/22/2007","recent"
115,"Owen","Bell","07/23/2006","recent"
116,"Penny","Collins","08/24/2005","missing"
117,"Quentin","Murphy","09/25/2014","outofdate"
118,"Rachel","Morgan","10/26/2013","missing"
119,"Steven","Perry","11/27/2012","recent"
120,"Tina","Powell","12/28/2011","recent"
121,"Uma","Murphy","01/29/2010","missing"
122,"Victor","Long","02/30/2009","outofdate"
123,"Willow","Patterson","03/31/2008","recent"
124,"Xavier","Hughes","04/01/2007","missing"
125,"Yara","Flores","05/02/2006","recent"
126,"Zane","Washington","06/03/2005","recent"
127,"Alice","Butler","07/04/2014","missing"
128,"Ben","Simmons","08/05/2013","missing"
129,"Cara","Foster","09/06/2012","outofdate"
130,"Drew","Gonzales","10/07/2011","recent"
131,"Ella","Bryant","11/08/2010","recent"
132,"Finn","Alexander","12/09/2009","missing"
133,"Gina","Russell","01/10/2008","missing"
134,"Hugo","Griffin","02/11/2007","recent"
135,"Iris","Diaz","03/12/2006","recent"
136,"Jake","Hayes","04/13/2005","missing"
137,"Kara","Myers","05/14/2014","outofdate"
138,"Luca","Ford","06/15/2013","recent"
139,"Maya","Nguyen","07/16/2012","recent"
140,"Noah","Peterson","08/17/2011","missing"
141,"Olive","Flores","09/18/2010","outofdate"
142,"Piper","Ramirez","10/19/2009","missing"
143,"Quincy","Howard","11/20/2008","recent"
144,"Rosa","Long","12/21/2007","recent"
145,"Sam","Bennett","01/22/2006","missing"
146,"Tina","Baker","02/23/2005","outofdate"
147,"Ulysses","Davis","03/24/2014","recent"
148,"Violet","Torres","04/25/2013","recent"
149,"Wes","Cooper","05/26/2012","missing"
150,"Xena","Gray","06/27/2011","missing"
151,"Yasmin","Jenkins","07/28/2010","outofdate"
152,"Zach","Sanders","08/29/2009","recent"
153,"Amelia","Bell","09/30/2008","recent"
154,"Brandon","Collins","10/01/2007","missing"
155,"Clara","Murphy","11/02/2006","missing"
156,"Dylan","Morgan","12/03/2005","outofdate"
157,"Ella","Perry","01/04/2014","recent"
158,"Finn","Powell","02/05/2013","recent"
159,"Grace","Murphy","03/06/2012","missing"
160,"Hank","Long","04/07/2011","outofdate"
161,"Ivy","Patterson","05/08/2010","missing"
162,"Jack","Hughes","06/09/2009","recent"
163,"Kylie","Flores","07/10/2008","recent"
164,"Liam","Washington","08/11/2007","missing"
165,"Mia","Butler","09/12/2006","outofdate"
166,"Nate","Simmons","10/13/2005","recent"
167,"Olivia","Foster","11/14/2014","recent"
168,"Paul","Gonzales","12/15/2013","missing"
169,"Quinn","Bryant","01/16/2012","missing"
170,"Ruby","Alexander","02/17/2011","outofdate"
171,"Sam","Russell","03/18/2010","recent"
172,"Tina","Griffin","04/19/2009","recent"
173,"Uma","Diaz","05/20/2008","missing"
174,"Victor","Hayes","06/21/2007","outofdate"
175,"Willow","Myers","07/22/2006","recent"
176,"Xavier","Ford","08/23/2005","recent"
177,"Yara","Nguyen","09/24/2014","missing"
178,"Zane","Peterson","10/25/2013","outofdate"
179,"Alice","Flores","11/26/2012","recent"
180,"Ben","Ramirez","12/27/2011","recent"
181,"Cara","Howard","01/28/2010","missing"
182,"Drew","Long","02/29/2009","outofdate"
183,"Ella","Bennett","03/30/2008","recent"
184,"Finn","Baker","04/01/2007","recent"
185,"Gina","Davis","05/02/2006","missing"
186,"Hugo","Torres","06/03/2005","recent"
187,"Iris","Cooper","07/04/2014","outofdate"
188,"Jake","Gray","08/05/2013","recent"
189,"Kara","Jenkins","09/06/2012","missing"
190,"Luca","Sanders","10/07/2011","recent"
191,"Maya","Bell","11/08/2010","missing"
192,"Noah","Collins","12/09/2009","outofdate"
193,"Olive","Murphy","01/10/2008","recent"
194,"Piper","Morgan","02/11/2007","recent"
195,"Quincy","Perry","03/12/2006","missing"
196,"Rosa","Powell","04/13/2005","outofdate"
197,"Sam","Murphy","05/14/2014","recent"
198,"Tina","Long","06/15/2013","missing"
199,"Uma","Patterson","07/16/2012","recent"
4 changes: 2 additions & 2 deletions examples/sql-integration/seeds/db1/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ CREATE TABLE school_entry_examination (
first_name TEXT,
last_name TEXT,
date_of_birth TEXT,
sufficiently_vaccinated BOOLEAN,
special_educational_needs BOOLEAN
sufficiently_vaccinated INT,
special_educational_needs INT
);

LOAD DATA INFILE '/var/lib/mysql-files/school_entry_examination.csv'
Expand Down
Loading

0 comments on commit 7bc3bab

Please sign in to comment.