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

Function TEST_F

cpp/src/gandiva/tests/date_time_test.cc:117–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117TEST_F(DateTimeTestProjector, TestIsNull) {
118 auto d0 = field("d0", date64());
119 auto t0 = field("t0", time32(arrow::TimeUnit::MILLI));
120 auto schema = arrow::schema({d0, t0});
121
122 // output fields
123 auto b0 = field("isnull", boolean());
124
125 // isnull and isnotnull
126 auto isnull_expr = TreeExprBuilder::MakeExpression("isnull", {d0}, b0);
127 auto isnotnull_expr = TreeExprBuilder::MakeExpression("isnotnull", {t0}, b0);
128
129 std::shared_ptr<Projector> projector;
130 auto status = Projector::Make(schema, {isnull_expr, isnotnull_expr},
131 TestConfiguration(), &projector);
132 ASSERT_TRUE(status.ok());
133
134 int num_records = 4;
135 std::vector<int64_t> d0_data = {0, 100, 0, 1000};
136 auto t0_data = {0, 100, 0, 1000};
137 auto validity = {false, true, false, true};
138 auto d0_array =
139 MakeArrowTypeArray<arrow::Date64Type, int64_t>(date64(), d0_data, validity);
140 auto t0_array = MakeArrowTypeArray<arrow::Time32Type, int32_t>(
141 time32(arrow::TimeUnit::MILLI), t0_data, validity);
142
143 // expected output
144 auto exp_isnull =
145 MakeArrowArrayBool({true, false, true, false}, {true, true, true, true});
146 auto exp_isnotnull = MakeArrowArrayBool(validity, {true, true, true, true});
147
148 // prepare input record batch
149 auto in_batch = arrow::RecordBatch::Make(schema, num_records, {d0_array, t0_array});
150
151 // Evaluate expression
152 arrow::ArrayVector outputs;
153 status = projector->Evaluate(*in_batch, pool_, &outputs);
154 EXPECT_TRUE(status.ok());
155
156 // Validate results
157 EXPECT_ARROW_ARRAY_EQUALS(exp_isnull, outputs.at(0));
158 EXPECT_ARROW_ARRAY_EQUALS(exp_isnotnull, outputs.at(1));
159}
160
161TEST_F(DateTimeTestProjector, TestDate32IsNull) {
162 auto d0 = field("d0", date32());

Callers

nothing calls this directly

Calls 15

TestConfigurationFunction · 0.85
EpochFunction · 0.85
MillisSinceFunction · 0.85
DaysSinceFunction · 0.85
MillisInDayFunction · 0.85
push_backMethod · 0.80
fieldFunction · 0.50
time32Function · 0.50
schemaFunction · 0.50
MakeFunction · 0.50
timestampFunction · 0.50
MakeFunctionFunction · 0.50

Tested by

no test coverage detected