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

Function TEST_F

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

Source from the content-addressed store, hash-verified

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