Skip to content

Commit

Permalink
add tests per aggregation function with empty group
Browse files Browse the repository at this point in the history
Signed-off-by: galsalomon66 <[email protected]>
  • Loading branch information
galsalomon66 committed Oct 1, 2023
1 parent 8af5653 commit a68e97f
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions test/s3select_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,69 @@ TEST(TestS3selectFunctions, count)
ASSERT_EQ(s3select_result_1,"128");
}

TEST(TestS3selectFunctions, no_args)
{//note: engine throw an exception(and description), currently it is not catch in this test-app
#if 0
std::string input;
size_t size = 128;
generate_columns_csv(input, size);
std::string input_query_1 = "select min() from stdin;";

std::string s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"");

input_query_1 = "select max() from stdin;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"");

input_query_1 = "select avg() from stdin;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"");

input_query_1 = "select sum() from stdin;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"");
#endif
}

TEST(TestS3selectFunctions, empty_group_upon_aggtegation)
{

std::string input;
size_t size = 128;
generate_columns_csv(input, size);
std::string input_query_1 = "select min(cast(_1 as int)) from stdin where 1 = 0;";

std::string s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"null");

input_query_1 = "select max(cast(_1 as int)) from stdin where 1 = 0;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"null");

input_query_1 = "select sum(cast(_1 as int)) from stdin where 1 = 0;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"null");

input_query_1 = "select avg(cast(_1 as int)) from stdin where 1 = 0;";

s3select_result_1 = run_s3select(input_query_1,input);

ASSERT_EQ(s3select_result_1,"null");
}

TEST(TestS3selectFunctions, min)
{
std::string input;
Expand Down

0 comments on commit a68e97f

Please sign in to comment.