MCPcopy Create free account
hub / github.com/apache/arrow / TEST_F

Function TEST_F

cpp/src/gandiva/tests/huge_table_test.cc:47–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45};
46
47TEST_F(LARGE_MEMORY_TEST(TestHugeProjector), SimpleTestSumHuge) {
48 auto atype = arrow::TypeTraits<arrow::Int32Type>::type_singleton();
49
50 // schema for input fields
51 auto field0 = field("f0", atype);
52 auto field1 = field("f1", atype);
53 auto schema = arrow::schema({field0, field1});
54
55 // output fields
56 auto field_sum = field("add", atype);
57
58 // Build expression
59 auto sum_expr = TreeExprBuilder::MakeExpression("add", {field0, field1}, field_sum);
60 std::shared_ptr<Projector> projector;
61 auto status = Projector::Make(schema, {sum_expr}, TestConfiguration(), &projector);
62 EXPECT_TRUE(status.ok());
63
64 // Create a row-batch with some sample data
65 // Cause an overflow in int32_t
66 int64_t num_records = static_cast<int64_t>(INT32_MAX) + 3;
67 std::vector<int32_t> input0 = {2, 29, 5, 37, 11, 59, 17, 19};
68 std::vector<int32_t> input1 = {23, 3, 31, 7, 41, 47, 13};
69 std::vector<bool> validity;
70
71 std::vector<int32_t> arr1;
72 std::vector<int32_t> arr2;
73 // expected output
74 std::vector<int32_t> sum1;
75
76 for (int64_t i = 0; i < num_records; i++) {
77 arr1.push_back(input0[i % 8]);
78 arr2.push_back(input1[i % 7]);
79 sum1.push_back(input0[i % 8] + input1[i % 7]);
80 validity.push_back(true);
81 }
82
83 auto exp_sum = MakeArrowArray<arrow::Int32Type, int32_t>(sum1, validity);
84 auto array0 = MakeArrowArray<arrow::Int32Type, int32_t>(arr1, validity);
85 auto array1 = MakeArrowArray<arrow::Int32Type, int32_t>(arr2, validity);
86
87 // prepare input record batch
88 auto in_batch = arrow::RecordBatch::Make(schema, num_records, {array0, array1});
89
90 // Evaluate expression
91 arrow::ArrayVector outputs;
92 status = projector->Evaluate(*in_batch, pool_, &outputs);
93 EXPECT_TRUE(status.ok());
94
95 // Validate results
96 EXPECT_ARROW_ARRAY_EQUALS(exp_sum, outputs.at(0));
97}
98
99TEST_F(LARGE_MEMORY_TEST(TestHugeFilter), TestSimpleHugeFilter) {
100 // Create a row-batch with some sample data

Callers

nothing calls this directly

Calls 10

TestConfigurationFunction · 0.85
push_backMethod · 0.80
type_singletonFunction · 0.50
fieldFunction · 0.50
schemaFunction · 0.50
MakeFunction · 0.50
MakeFunctionFunction · 0.50
okMethod · 0.45
EvaluateMethod · 0.45
ToArrayMethod · 0.45

Tested by

no test coverage detected