Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

[NSE-48] fix c++ unit tests #60

Merged
merged 3 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions cpp/src/tests/arrow_compute_test_aggregate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ TEST(TestArrowCompute, AggregatewithMultipleBatchTest) {
f_sum, f_count, f_sum, f_count, f_float, f_res, f_res, f_float, f_float, f_float};
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> result_batch;
std::vector<std::string> input_data_string = {"[8, 10, 9, 20, 55, 42, 28, 32, 54, 70]",
Expand Down Expand Up @@ -141,7 +142,8 @@ TEST(TestArrowCompute, GroupByAggregateWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -218,7 +220,8 @@ TEST(TestArrowCompute, GroupByAvgWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -284,7 +287,8 @@ TEST(TestArrowCompute, GroupByCountAllWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -352,7 +356,8 @@ TEST(TestArrowCompute, GroupByTwoAggregateWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -426,7 +431,8 @@ TEST(TestArrowCompute, GroupByTwoUtf8AggregateWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -490,7 +496,8 @@ TEST(TestArrowCompute, GroupByAggregateWithMultipleBatchOutputWoKeyTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -547,7 +554,8 @@ TEST(TestArrowCompute, StddevSampFinalTest) {
std::vector<std::shared_ptr<Field>> ret_types = {f_float};
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> result_batch;
std::vector<std::string> input_data_string = {
Expand Down Expand Up @@ -604,7 +612,8 @@ TEST(TestArrowCompute, GroupByStddevSampPartialWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -679,7 +688,8 @@ TEST(TestArrowCompute, GroupByStddevSampFinalWithMultipleBatchTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -748,7 +758,8 @@ TEST(TestArrowCompute, GroupbySumCountMergeTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down
33 changes: 22 additions & 11 deletions cpp/src/tests/arrow_compute_test_hashaggregate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ TEST(TestArrowCompute, GroupByHashAggregateTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -155,7 +156,8 @@ TEST(TestArrowCompute, GroupByHashAggregateTest2) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -243,7 +245,8 @@ TEST(TestArrowCompute, GroupByHashAggregateTest3) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -321,7 +324,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithStringTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -403,7 +407,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithProjectionTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -489,7 +494,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithCaseWhenTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -567,7 +573,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithNoKeyTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -649,7 +656,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithTwoStringTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -732,7 +740,8 @@ TEST(TestArrowCompute, GroupByHashAggregateWithProjectedKeyTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -815,7 +824,8 @@ TEST(TestArrowCompute, GroupByStddevSampPartialHashAggregateTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down Expand Up @@ -904,7 +914,8 @@ TEST(TestArrowCompute, GroupByStddevSampFinalHashAggregateTest) {

/////////////////////// Create Expression Evaluator ////////////////////
std::shared_ptr<CodeGenerator> expr;
ASSERT_NOT_OK(CreateCodeGenerator(sch, expr_vector, ret_types, &expr, true));
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), sch, expr_vector, ret_types, &expr, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
std::vector<std::shared_ptr<arrow::RecordBatch>> output_batch_list;

Expand Down
24 changes: 16 additions & 8 deletions cpp/src/tests/arrow_compute_test_join.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingInnerJoin) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table0_f0, table0_f1, table0_f2, table1_f0, table1_f1}, &expr_probe, true));
std::shared_ptr<arrow::RecordBatch> input_batch;
Expand Down Expand Up @@ -182,7 +183,8 @@ TEST(TestArrowComputeJoin, JoinTestWithTwoKeysUsingInnerJoin) {

///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table0_f0, table0_f1, table0_f2, table1_f0, table1_f1}, &expr_probe, true));

Expand Down Expand Up @@ -288,7 +290,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingOuterJoin) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table0_f0, table0_f1, table0_f2, table1_f0, table1_f1}, &expr_probe, true));

Expand Down Expand Up @@ -397,7 +400,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingAntiJoin) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(schema_table_0, {probeArrays_expr},
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), schema_table_0, {probeArrays_expr},
{table1_f0, table1_f1}, &expr_probe, true));
std::shared_ptr<arrow::RecordBatch> input_batch;

Expand Down Expand Up @@ -503,7 +507,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingInnerJoinWithCondition) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table0_f0, table0_f1, table0_f2, table1_f0, table1_f1}, &expr_probe, true));

Expand Down Expand Up @@ -612,7 +617,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingAntiJoinWithCondition) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(schema_table_0, {probeArrays_expr},
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(), schema_table_0, {probeArrays_expr},
{table1_f0, table1_f1}, &expr_probe, true));
std::shared_ptr<arrow::RecordBatch> input_batch;

Expand Down Expand Up @@ -715,7 +721,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingExistenceJoin) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table1_f0, field("table1_exists", boolean()), table1_f1}, &expr_probe, true));

Expand Down Expand Up @@ -836,7 +843,8 @@ TEST(TestArrowComputeJoin, JoinTestUsingInnerJoinWithProjectedCondition) {
arrow::schema({table0_f0, table0_f1, table0_f2, table1_f0, table1_f1});
///////////////////// Calculation //////////////////
std::shared_ptr<CodeGenerator> expr_probe;
ASSERT_NOT_OK(CreateCodeGenerator(
arrow::compute::FunctionContext ctx;
ASSERT_NOT_OK(CreateCodeGenerator(ctx.memory_pool(),
schema_table_0, {probeArrays_expr},
{table0_f0, table0_f1, table0_f2, table1_f0, table1_f1}, &expr_probe, true));

Expand Down
Loading