Skip to content

Commit

Permalink
Test for checking results against aws
Browse files Browse the repository at this point in the history
Added query generator which generates equivalent queries for aws
and ceph. After runing these queries, their results are matched.

Signed-off-by: Girjesh Rajoria <grajoria@redhat.com>
  • Loading branch information
grajoria committed Mar 26, 2021
1 parent b95da97 commit 3f80232
Show file tree
Hide file tree
Showing 16 changed files with 520 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/queries_generator/aws_queries.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
select lower(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from s3object;
select to_timestamp('1999-11-04T20:27:03.479340Z') from s3object;
select date_add(day, 8, to_timestamp('1982-02-03T00:20:12.42831Z')) from s3object;
select substring(upper(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## '), cast((avg(cast(_3 as int)-cast(_2 as int)) - 3) as int), min(cast(_1 as int)-cast(_1 as int)) + 7) from s3object;
select 10-cast(_2 as int) from s3object;
select character_length(to_string(to_timestamp('1963-06-22T05:35:39.954350Z'), 'SSSSS HH ')) from s3object;
select cast(_2 as int)-2 from s3object;
select char_length(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from s3object;
select to_string(date_add(second, 5, to_timestamp('1938-09-24T10:57:42.142042Z')), 'hh ') from s3object;
select to_timestamp('1931-12-23T02:54:25.451925Z') from s3object;
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
%%abcdefghijklmnopqrstuvwxyz##
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output10.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
1931-12-23T02:54:25.451925Z
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
1999-11-04T20:27:03.479340Z
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output3.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1982-02-11T00:20:12.42831Z
1 change: 1 addition & 0 deletions test/queries_generator/aws_results/output4.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output5.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-42916
-21159
-35571
-38378
-42792
-45572
-8538
-22623
-38429
-6601
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output6.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
9
9
9
9
9
9
9
9
9
9
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output7.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
42924
21167
35579
38386
42800
45580
8546
22631
38437
6609
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output8.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
34
34
34
34
34
34
34
34
34
34
10 changes: 10 additions & 0 deletions test/queries_generator/aws_results/output9.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
10
10
10
10
10
10
10
10
10
10
26 changes: 26 additions & 0 deletions test/queries_generator/generate_aws_cmds.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
fstream query_file, cmd_file;
query_file.open("aws_queries.txt", ios::in);
cmd_file.open("aws_cmds.sh", ios::out);
cmd_file << "#!/bin/sh\nset -x\nset -e\n\n";
cmd_file << "mkdir -p aws_results\n";
string bucket, csv_file, query, aws_cmd;
cout << "Enter bucket name: ";
cin >> bucket;
cout << "Enter file name: ";
cin >> csv_file;
for(int i = 1; getline(query_file, query); i++)
{
aws_cmd = "aws s3api select-object-content --bucket " + bucket + " --key " + csv_file + " --expression-type \'SQL\' --input-serialization \'{\"CSV\": {}, \"CompressionType\": \"NONE\"}\' --output-serialization \'{\"CSV\": {}}\' --profile openshift-dev --expression \"" + query + "\" \"aws_results/output" + to_string(i) + ".csv\"";
cmd_file << aws_cmd << endl;
}
cmd_file.close();
query_file.close();
return 0;
}
10 changes: 10 additions & 0 deletions test/queries_generator/queries.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
select lower(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from stdin;
select to_timestamp('1999-11-04T20:27:03.479340Z') from stdin;
select date_add(day, int(8), to_timestamp('1982-02-03T00:20:12.42831Z')) from stdin;
select substring(upper(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## '), int(avg(int(_3)-int(_2)) - int(3)), min(int(_1)-int(_1)) + int(7)) from stdin;
select int(10)-int(_2) from stdin;
select character_length(to_string(to_timestamp('1963-06-22T05:35:39.954350Z'), 'SSSSS HH ')) from stdin;
select int(_2)-int(2) from stdin;
select char_length(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from stdin;
select to_string(date_add(second, int(5), to_timestamp('1938-09-24T10:57:42.142042Z')), 'hh ') from stdin;
select to_timestamp('1931-12-23T02:54:25.451925Z') from stdin;
Loading

0 comments on commit 3f80232

Please sign in to comment.