Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for nested queries and against aws #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

grajoria
Copy link

@grajoria grajoria commented Mar 10, 2021

Added tests to run nested complex queries which are combinations of
various functions. Equivalent queries runs for aws and ceph, then results are matched

Signed-off-by: Girjesh Rajoria [email protected]

@grajoria grajoria changed the title Tests for nested queries Tests for nested queries and against aws Mar 24, 2021
@grajoria grajoria force-pushed the tests branch 2 times, most recently from f3f022a to 3f80232 Compare March 26, 2021 07:47
@@ -0,0 +1,4 @@
select to_string(to_timestamp('2009-09-17T17:56:06.234567Z'), substring(' athmywopgss-nghjkl', 3, 10)) from stdin;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in multi-row tests , its not correct to use fixed value, should use a column reference

@@ -0,0 +1,4 @@
select to_string(to_timestamp('2009-09-17T17:56:06.234567Z'), substring(' athmywopgss-nghjkl', 3, 10)) from stdin;
select to_timestamp(upper('2009-09-17t17:56:06.234567z')) from stdin;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same as above

set -x
set -e

g++ -o queries_generator queries_generator.cpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its binary utility (cpp sources), it should be a part of project cmake (not need for run.sh)
these utilities need several steps until completion, so its better to add help section to explain that.

@@ -0,0 +1,10 @@
select lower(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from s3object;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some queries containing only constant values which means their results is static (no change between rows)
those kind of queries not need an input object (actually any input object will produce the same result)

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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
this kind of query is unique, since its complex and nested, in such case there is a true need for AWS results to compare.

@@ -0,0 +1,10 @@
select lower(lower(' %%AbCdEfGhIjKlMnOpQrStUvWxYz## ')) from s3object;
select to_timestamp('1999-11-04T20:27:03.479340Z') from s3object;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contain only constant values

@@ -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;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contain only constant values

@@ -0,0 +1,10 @@
1931-12-23T02:54:25.451925Z

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Z thing cause a failure upon comparing results.
since results are static, and the Z thing has no meaning, it can be removed

{
int num = 1 + (rand() % NUM_COLUMN_INT);
aws_expr = "cast(_" + to_string(num) + " as int)";
return "int(_" + to_string(num) + ")";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in our current status, there is no difference between aws-expr to ceph-expr.
which is the best thing for comparison tests.
same input queries should produce the same output results.

the "int/float ( ... ) " should remove from the code generator

type = rand() % 4;
ceph_query = ceph_query + random_query_expr(depth, type,
aws_expr)+ " from stdin;";
aws_query = aws_query + aws_expr + " from s3object;";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for stdin( it's for specific use-cases, not relevant for this comparison)

Added query generator which generates equivalent queries for aws
and ceph. After runing these queries, their results are matched.

Signed-off-by: Girjesh Rajoria <[email protected]>
else if (type == TIMESTAMP) // return type is TIMESTAMP
{
//switch (option = rand() % 2)
//{
Copy link

@galsalomon66 galsalomon66 Jul 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this section is commented?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because if we have to_timestamp function here, it generates simple queries with it. So it is only called depth is zero.

fstream query_file, cmd_file;
query_file.open("queries.txt", ios::in);
cmd_file.open("aws_cmds.sh", ios::out);
cmd_file << "#!/bin/sh\nset -x\nset -e\n\n";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another option is to use popen( ... )
https://man7.org/linux/man-pages/man3/popen.3.html
and get rid of the shell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants