46 REQUIRE(specs[1].
left == (
DatumSpec{std::string{
"eta"}, 3, atype::FLOAT}));
54 REQUIRE(specs[3].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
58 REQUIRE(specs[4].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
72 REQUIRE(gspecs[2].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
80 REQUIRE(gspecs[4].
left == (
DatumSpec{std::string{
"eta"}, 3, atype::FLOAT}));
91 REQUIRE(hspecs[1].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
95 REQUIRE(hspecs[2].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
113 REQUIRE(uspecs[3].
left == (
DatumSpec{std::string{
"phi"}, 2, atype::FLOAT}));
121 REQUIRE(uspecs[5].
left == (
DatumSpec{std::string{
"eta"}, 3, atype::FLOAT}));
126 Filter ptfilter = o2::aod::track::pt > pTCut;
127 REQUIRE(ptfilter.
node->self.index() == 2);
128 REQUIRE(ptfilter.
node->left->self.index() == 1);
129 REQUIRE(ptfilter.
node->right->self.index() == 3);
131 REQUIRE(ptfilterspecs[0].
left == (
DatumSpec{std::string{
"fPt"},
typeid(o2::aod::track::Pt).hash_code(), atype::FLOAT}));
136 std::string prefix =
"prefix";
139 Filter ptfilter2 = o2::aod::track::pt >
group.pTCut;
140 group.pTCut.name.insert(0, 1,
'.');
142 REQUIRE(ptfilter2.
node->self.index() == 2);
143 REQUIRE(ptfilter2.
node->left->self.index() == 1);
144 REQUIRE(ptfilter2.
node->right->self.index() == 3);
145 REQUIRE(std::get<PlaceholderNode>(ptfilter2.
node->right->self).name ==
"prefix.pTCut");
147 REQUIRE(ptfilterspecs2[0].
left == (
DatumSpec{std::string{
"fPt"},
typeid(o2::aod::track::Pt).hash_code(), atype::FLOAT}));
154 Projector pze = o2::aod::track::Pze::Projector();
156 REQUIRE(pzspecs[0].
left == (
DatumSpec{std::string{
"fTgl"},
typeid(o2::aod::track::Tgl).hash_code(), atype::FLOAT}));
161 REQUIRE(pzspecs[1].
right == (
DatumSpec{std::string{
"fSigned1Pt"},
typeid(o2::aod::track::Signed1Pt).hash_code(), atype::FLOAT}));
163 auto infield1 = o2::aod::track::Signed1Pt::asArrowField();
164 auto infield2 = o2::aod::track::Tgl::asArrowField();
165 auto resfield = o2::aod::track::Pze::asArrowField();
166 auto schema = std::make_shared<arrow::Schema>(std::vector{infield1, infield2, resfield});
170 REQUIRE(std::string(gandiva_expression->ToString()) == std::string(
"float multiply((float) fTgl, float divide((const float) 1 raw(3f800000), (float) fSigned1Pt))"));
173 Projector pte = o2::aod::track::Pt::Projector();
176 auto infield3 = o2::aod::track::Signed1Pt::asArrowField();
177 auto resfield2 = o2::aod::track::Pt::asArrowField();
178 auto schema2 = std::make_shared<arrow::Schema>(std::vector{infield3, resfield2});
181 auto gandiva_expression2 =
makeExpression(gandiva_tree2, resfield2);
182 REQUIRE(gandiva_expression2->ToString() ==
"if (bool less_than_or_equal_to(float absf((float) fSigned1Pt), (const float) 1.17549e-38 raw(800000))) { (const float) 8.50706e+37 raw(7e800000) } else { float absf(float divide((const float) 1 raw(3f800000), (float) fSigned1Pt)) }");
186 auto schema_p = std::make_shared<arrow::Schema>(fields);
195 REQUIRE(bwf[1].
left == (
DatumSpec{std::string{
"fFlags"},
typeid(o2::aod::track::Flags).hash_code(), atype::UINT32}));
199 auto infield4 = o2::aod::track::Flags::asArrowField();
200 auto resfield3 = std::make_shared<arrow::Field>(
"out", arrow::boolean());
201 auto schema_b = std::make_shared<arrow::Schema>(std::vector{infield4, resfield3});
203 REQUIRE(gandiva_tree3->ToString() ==
"bool not_equal(uint32 bitwise_and((uint32) fFlags, (const uint32) 2), (const uint32) 0)");
205 std::shared_ptr<gandiva::Filter> flt;
206 auto s = gandiva::Filter::Make(schema_b, condition, &flt);
209 Filter rounding = nround(o2::aod::track::pt) > 0.1f;
215 REQUIRE(rf[1].
left == (
DatumSpec{std::string{
"fPt"},
typeid(o2::aod::track::Pt).hash_code(), atype::FLOAT}));
219 auto infield5 = o2::aod::track::Pt::asArrowField();
220 auto resfield4 = std::make_shared<arrow::Field>(
"out", arrow::boolean());
221 auto schema_c = std::make_shared<arrow::Schema>(std::vector{infield5, resfield4});
223 REQUIRE(gandiva_tree4->ToString() ==
"bool greater_than(float round((float) fPt), (const float) 0.1 raw(3dcccccd))");
225 std::shared_ptr<gandiva::Filter> flt2;
226 auto s2 = gandiva::Filter::Make(schema_c, condition2, &flt2);
233 Filter cf = nabs(o2::aod::track::eta) < 1.0f &&
ifnode((o2::aod::track::pt < 1.0f), (o2::aod::track::phi > (
float)(M_PI / 2.)), (o2::aod::track::phi < (
float)(M_PI / 2.)));
241 REQUIRE(cfspecs[1].condition == (
DatumSpec{5u, atype::BOOL}));
244 REQUIRE(cfspecs[2].
left == (
DatumSpec{std::string{
"fPt"},
typeid(o2::aod::track::Pt).hash_code(), atype::FLOAT}));
248 REQUIRE(cfspecs[3].
left == (
DatumSpec{std::string{
"fPhi"},
typeid(o2::aod::track::Phi).hash_code(), atype::FLOAT}));
252 REQUIRE(cfspecs[4].
left == (
DatumSpec{std::string{
"fPhi"},
typeid(o2::aod::track::Phi).hash_code(), atype::FLOAT}));
260 REQUIRE(cfspecs[6].
left == (
DatumSpec{std::string{
"fEta"},
typeid(o2::aod::track::Eta).hash_code(), atype::FLOAT}));
264 auto infield1 = o2::aod::track::Pt::asArrowField();
265 auto infield2 = o2::aod::track::Eta::asArrowField();
266 auto infield3 = o2::aod::track::Phi::asArrowField();
267 auto schema = std::make_shared<arrow::Schema>(std::vector{infield1, infield2, infield3});
270 auto gandiva_filter =
createFilter(schema, gandiva_condition);
272 REQUIRE(gandiva_tree->ToString() ==
"bool less_than(float absf((float) fEta), (const float) 1 raw(3f800000)) && if (bool less_than((float) fPt, (const float) 1 raw(3f800000))) { bool greater_than((float) fPhi, (const float) 1.5708 raw(3fc90fdb)) } else { bool less_than((float) fPhi, (const float) 1.5708 raw(3fc90fdb)) }");
275 Filter cfn = o2::aod::track::signed1Pt > 0.f &&
ifnode(std::move(*cf.
node), nabs(o2::aod::track::x) > 1.0f, nabs(o2::aod::track::y) > 1.0f);
277 auto infield4 = o2::aod::track::Signed1Pt::asArrowField();
278 auto infield5 = o2::aod::track::X::asArrowField();
279 auto infield6 = o2::aod::track::Y::asArrowField();
280 auto schema2 = std::make_shared<arrow::Schema>(std::vector{infield1, infield2, infield3, infield4, infield5, infield6});
283 auto gandiva_filter2 =
createFilter(schema2, gandiva_condition2);
284 REQUIRE(gandiva_tree2->ToString() ==
"bool greater_than((float) fSigned1Pt, (const float) 0 raw(0)) && if (bool less_than(float absf((float) fEta), (const float) 1 raw(3f800000)) && if (bool less_than((float) fPt, (const float) 1 raw(3f800000))) { bool greater_than((float) fPhi, (const float) 1.5708 raw(3fc90fdb)) } else { bool less_than((float) fPhi, (const float) 1.5708 raw(3fc90fdb)) }) { bool greater_than(float absf((float) fX), (const float) 1 raw(3f800000)) } else { bool greater_than(float absf((float) fY), (const float) 1 raw(3f800000)) }");