Project
Loading...
Searching...
No Matches
Expressions.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15#include "arrow/table.h"
16#include "gandiva/tree_expr_builder.h"
17#include <algorithm>
18#include <iostream>
19#include <set>
20#include <stack>
21#include <unordered_map>
22
23using namespace o2::framework;
24
26{
27void unknownParameterUsed(const char* name)
28{
29 runtime_error_f("Unknown parameter used in expression: %s", name);
30}
31
34static const std::array<std::string, BasicOp::Conditional + 1> basicOperationsMap = {
35 "and",
36 "or",
37 "add",
38 "subtract",
39 "divide",
40 "multiply",
41 "bitwise_and",
42 "bitwise_or",
43 "bitwise_xor",
44 "less_than",
45 "less_than_or_equal_to",
46 "greater_than",
47 "greater_than_or_equal_to",
48 "equal",
49 "not_equal",
50 "atan2f",
51 "powerf",
52 "sqrtf",
53 "expf",
54 "logf",
55 "log10f",
56 "sinf",
57 "cosf",
58 "tanf",
59 "asinf",
60 "acosf",
61 "atanf",
62 "absf",
63 "round",
64 "bitwise_not",
65 "if"};
66
68{
69 std::stack<NodeRecord> path;
70 auto local_index = index;
71 path.emplace(node, 0);
72
73 while (!path.empty()) {
74 auto top = path.top();
75 top.node_ptr->index = local_index;
76 path.pop();
77 if (top.node_ptr->condition != nullptr) {
78 // start new subtrees
79 index = designateSubtrees(top.node_ptr->left.get(), local_index + 1);
80 index = designateSubtrees(top.node_ptr->condition.get(), index + 1);
81 index = designateSubtrees(top.node_ptr->right.get(), index + 1);
82 } else {
83 // continue current subtree
84 if (top.node_ptr->left != nullptr) {
85 path.emplace(top.node_ptr->left.get(), 0);
86 }
87 if (top.node_ptr->right != nullptr) {
88 path.emplace(top.node_ptr->right.get(), 0);
89 }
90 }
91 }
92
93 return index;
94}
95
96template <typename T>
97constexpr inline auto makeDatum(T const&)
98{
99 return DatumSpec{};
100}
101
102template <is_literal_like T>
103constexpr inline auto makeDatum(T const& node)
104{
105 return DatumSpec{node.value, node.type};
106}
107
108template <is_binding T>
109constexpr inline auto makeDatum(T const& node)
110{
111 return DatumSpec{node.name, node.hash, node.type};
112}
113
114template <typename T>
115constexpr inline auto makeOp(T const&, size_t const&)
116{
117 return ColumnOperationSpec{};
118}
119
120template <is_operation T>
121constexpr inline auto makeOp(T const& node, size_t const& index)
122{
123 return ColumnOperationSpec{node.op, index};
124}
125
126template <is_conditional T>
127constexpr inline auto makeOp(T const&, size_t const& index)
128{
129 return ColumnOperationSpec{BasicOp::Conditional, index};
130}
131
132std::shared_ptr<arrow::DataType> concreteArrowType(atype::type type)
133{
134 switch (type) {
135 case atype::UINT8:
136 return arrow::uint8();
137 case atype::INT8:
138 return arrow::int8();
139 case atype::INT16:
140 return arrow::int16();
141 case atype::UINT16:
142 return arrow::uint16();
143 case atype::INT32:
144 return arrow::int32();
145 case atype::UINT32:
146 return arrow::uint32();
147 case atype::INT64:
148 return arrow::int64();
149 case atype::UINT64:
150 return arrow::uint64();
151 case atype::FLOAT:
152 return arrow::float32();
153 case atype::DOUBLE:
154 return arrow::float64();
155 case atype::BOOL:
156 return arrow::boolean();
157 default:
158 return nullptr;
159 }
160}
161
162std::string upcastTo(atype::type f)
163{
164 switch (f) {
165 case atype::INT32:
166 return "castINT";
167 case atype::INT64:
168 return "castBIGINT";
169 case atype::FLOAT:
170 return "castFLOAT4";
171 case atype::DOUBLE:
172 return "castFLOAT8";
173 default:
174 throw runtime_error_f("Do not know how to cast to %s", stringType(f));
175 }
176}
177
178bool operator==(DatumSpec const& lhs, DatumSpec const& rhs)
179{
180 return (lhs.datum == rhs.datum) && (lhs.type == rhs.type);
181}
182
183std::ostream& operator<<(std::ostream& os, DatumSpec const& spec)
184{
185 std::visit(
187 [&os](LiteralNode::var_t&& arg) {
188 std::visit(
189 [&os](auto&& arg) { os << arg; },
190 arg);
191 },
192 [&os](size_t&& arg) { os << arg; },
193 [&os](std::string&& arg) { os << arg; },
194 [](auto&&) {}},
195 spec.datum);
196 return os;
197}
198
200{
201 expressions::walk(filter.node.get(), [&](Node* node) {
202 if (node->self.index() == 3) {
203 std::get_if<3>(&node->self)->reset(context);
204 }
205 });
206}
207
208const char* stringType(atype::type t)
209{
210 switch (t) {
211 case atype::BOOL:
212 return "bool";
213 case atype::DOUBLE:
214 return "double";
215 case atype::FLOAT:
216 return "float";
217 case atype::INT8:
218 return "int8";
219 case atype::INT16:
220 return "int16";
221 case atype::INT32:
222 return "int32";
223 case atype::INT64:
224 return "int64";
225 case atype::UINT8:
226 return "uint8";
227 case atype::UINT16:
228 return "uint16";
229 case atype::UINT32:
230 return "uint32";
231 case atype::UINT64:
232 return "uint64";
233 default:
234 return "unsupported";
235 }
237}
238
240{
241 Operations OperationSpecs;
242 std::stack<NodeRecord> path;
243 auto isLeaf = [](Node const* const node) {
244 return ((node->left == nullptr) && (node->right == nullptr));
245 };
246
247 auto processLeaf = [](Node const* const node) {
248 return std::visit(
249 [](auto const& n) { return makeDatum(n); },
250 node->self);
251 };
252
253 size_t index = 0;
254 // insert the top node into stack
255 path.emplace(expression.node.get(), index++);
256
257 // while the stack is not empty
258 while (!path.empty()) {
259 auto top = path.top();
260
261 // create operation spec, pop the node and add its children
262 auto operationSpec =
263 std::visit(
264 [&](auto const& n) { return makeOp(n, top.node_ptr->index); },
265 top.node_ptr->self);
266
267 operationSpec.result = DatumSpec{top.index, operationSpec.type};
268 path.pop();
269
270 auto* left = top.node_ptr->left.get();
271 bool leftLeaf = isLeaf(left);
272 size_t li = 0;
273 if (leftLeaf) {
274 operationSpec.left = processLeaf(left);
275 } else {
276 li = index;
277 operationSpec.left = DatumSpec{index++, atype::NA};
278 }
279
280 decltype(left) right = nullptr;
281 if (top.node_ptr->right != nullptr) {
282 right = top.node_ptr->right.get();
283 }
284 bool rightLeaf = true;
285 if (right != nullptr) {
286 rightLeaf = isLeaf(right);
287 }
288 size_t ri = 0;
289 auto isUnary = false;
290 if (top.node_ptr->right == nullptr) {
291 operationSpec.right = DatumSpec{};
292 isUnary = true;
293 } else {
294 if (rightLeaf) {
295 operationSpec.right = processLeaf(right);
296 } else {
297 ri = index;
298 operationSpec.right = DatumSpec{index++, atype::NA};
299 }
300 }
301
302 decltype(left) condition = nullptr;
303 if (top.node_ptr->condition != nullptr) {
304 condition = top.node_ptr->condition.get();
305 }
306 bool condleaf = condition != nullptr ? isLeaf(condition) : true;
307 size_t ci = 0;
308 if (condition != nullptr) {
309 if (condleaf) {
310 operationSpec.condition = processLeaf(condition);
311 } else {
312 ci = index;
313 operationSpec.condition = DatumSpec{index++, atype::BOOL};
314 }
315 } else {
316 operationSpec.condition = DatumSpec{};
317 }
318
319 OperationSpecs.push_back(std::move(operationSpec));
320 if (!leftLeaf) {
321 path.emplace(left, li);
322 }
323 if (!isUnary && !rightLeaf) {
324 path.emplace(right, ri);
325 }
326 if (!condleaf) {
327 path.emplace(condition, ci);
328 }
329 }
330 // at this stage the operations vector is created, but the field types are
331 // only set for the logical operations and leaf nodes
332 std::vector<atype::type> resultTypes;
333 resultTypes.resize(OperationSpecs.size());
334
335 auto inferResultType = [&resultTypes](DatumSpec& left, DatumSpec& right) {
336 // if the left datum is monostate (error)
337 if (left.datum.index() == 0) {
338 throw runtime_error("Malformed operation spec: empty left datum");
339 }
340
341 // check if the datums are references
342 if (left.datum.index() == 1) {
343 left.type = resultTypes[std::get<size_t>(left.datum)];
344 }
345
346 if (right.datum.index() == 1) {
347 right.type = resultTypes[std::get<size_t>(right.datum)];
348 }
349
350 auto t1 = left.type;
351 auto t2 = right.type;
352 // if the right datum is monostate (unary op)
353 if (right.datum.index() == 0) {
354 if (t1 == atype::DOUBLE) {
355 return atype::DOUBLE;
356 }
357 return atype::FLOAT;
358 }
359
360 if (t1 == t2) {
361 return t1;
362 }
363
364 auto isIntType = [](auto t) {
365 return (t == atype::UINT8) || (t == atype::INT8) || (t == atype::UINT16) || (t == atype::INT16) || (t == atype::UINT32) || (t == atype::INT32) || (t == atype::UINT64) || (t == atype::INT64);
366 };
367
368 if (isIntType(t1)) {
369 if (t2 == atype::FLOAT) {
370 return atype::FLOAT;
371 }
372 if (t2 == atype::DOUBLE) {
373 return atype::DOUBLE;
374 }
375 if (isIntType(t2)) {
376 if (t1 > t2) {
377 return t1;
378 }
379 return t2;
380 }
381 }
382 if (t1 == atype::FLOAT) {
383 if (isIntType(t2)) {
384 return atype::FLOAT;
385 }
386 if (t2 == atype::DOUBLE) {
387 return atype::DOUBLE;
388 }
389 }
390 if (t1 == atype::DOUBLE) {
391 return atype::DOUBLE;
392 }
393 throw runtime_error_f("Invalid combination of argument types %s and %s", stringType(t1), stringType(t2));
394 };
395
396 for (auto it = OperationSpecs.rbegin(); it != OperationSpecs.rend(); ++it) {
397 auto type = inferResultType(it->left, it->right);
398 if (it->type == atype::NA) {
399 it->type = type;
400 }
401
402 it->result.type = it->type;
403 resultTypes[std::get<size_t>(it->result.datum)] = it->type;
404 }
405
406 return OperationSpecs;
407}
408
409gandiva::ConditionPtr makeCondition(gandiva::NodePtr node)
410{
411 return gandiva::TreeExprBuilder::MakeCondition(std::move(node));
412}
413
414gandiva::ExpressionPtr makeExpression(gandiva::NodePtr node, gandiva::FieldPtr result)
415{
416 return gandiva::TreeExprBuilder::MakeExpression(std::move(node), std::move(result));
417}
418
419std::shared_ptr<gandiva::Filter>
420 createFilter(gandiva::SchemaPtr const& Schema, Operations const& opSpecs)
421{
422 std::shared_ptr<gandiva::Filter> filter;
423 auto s = gandiva::Filter::Make(Schema,
424 makeCondition(createExpressionTree(opSpecs, Schema)),
425 &filter);
426 if (!s.ok()) {
427 throw runtime_error_f("Failed to create filter: %s", s.ToString().c_str());
428 }
429 return filter;
430}
431
432std::shared_ptr<gandiva::Filter>
433 createFilter(gandiva::SchemaPtr const& Schema, gandiva::ConditionPtr condition)
434{
435 std::shared_ptr<gandiva::Filter> filter;
436 auto s = gandiva::Filter::Make(Schema,
437 condition,
438 &filter);
439 if (!s.ok()) {
440 throw runtime_error_f("Failed to create filter: %s", s.ToString().c_str());
441 }
442 return filter;
443}
444
445std::shared_ptr<gandiva::Projector>
446 createProjector(gandiva::SchemaPtr const& Schema, Operations const& opSpecs, gandiva::FieldPtr result)
447{
448 std::shared_ptr<gandiva::Projector> projector;
449 auto s = gandiva::Projector::Make(Schema,
450 {makeExpression(createExpressionTree(opSpecs, Schema), std::move(result))},
451 &projector);
452 if (!s.ok()) {
453 throw runtime_error_f("Failed to create projector: %s", s.ToString().c_str());
454 }
455 return projector;
456}
457
458std::shared_ptr<gandiva::Projector>
459 createProjector(gandiva::SchemaPtr const& Schema, Projector&& p, gandiva::FieldPtr result)
460{
461 return createProjector(Schema, createOperations(p), std::move(result));
462}
463
464std::shared_ptr<gandiva::Projector> createProjectorHelper(size_t nColumns, expressions::Projector* projectors,
465 std::shared_ptr<arrow::Schema> schema,
466 std::vector<std::shared_ptr<arrow::Field>> const& fields)
467{
468 std::vector<gandiva::ExpressionPtr> expressions;
469
470 for (size_t ci = 0; ci < nColumns; ++ci) {
471 expressions.push_back(
475 schema),
476 fields[ci]));
477 }
478
479 std::shared_ptr<gandiva::Projector> projector;
480 auto s = gandiva::Projector::Make(
481 schema,
482 expressions,
483 &projector);
484 if (s.ok()) {
485 return projector;
486 }
487 throw o2::framework::runtime_error_f("Failed to create projector: %s", s.ToString().c_str());
488}
489
490gandiva::Selection createSelection(std::shared_ptr<arrow::Table> const& table, std::shared_ptr<gandiva::Filter> const& gfilter)
491{
492 gandiva::Selection selection;
493 auto s = gandiva::SelectionVector::MakeInt64(table->num_rows(),
494 arrow::default_memory_pool(),
495 &selection);
496 if (!s.ok()) {
497 throw runtime_error_f("Cannot allocate selection vector %s", s.ToString().c_str());
498 }
499 if (table->num_rows() == 0) {
500 return selection;
501 }
502 arrow::TableBatchReader reader(*table);
503 std::shared_ptr<arrow::RecordBatch> batch;
504 while (true) {
505 s = reader.ReadNext(&batch);
506 if (!s.ok()) {
507 throw runtime_error_f("Cannot read batches from table %s", s.ToString().c_str());
508 }
509 if (batch == nullptr) {
510 break;
511 }
512 s = gfilter->Evaluate(*batch, selection);
513 if (!s.ok()) {
514 throw runtime_error_f("Cannot apply filter %s", s.ToString().c_str());
515 }
516 }
517
518 return selection;
519}
520
521gandiva::Selection createSelection(std::shared_ptr<arrow::Table> const& table,
522 Filter const& expression)
523{
524 return createSelection(table, createFilter(table->schema(), createOperations(std::move(expression))));
525}
526
527auto createProjection(std::shared_ptr<arrow::Table> const& table, std::shared_ptr<gandiva::Projector> const& gprojector)
528{
529 arrow::TableBatchReader reader(*table);
530 std::shared_ptr<arrow::RecordBatch> batch;
531 std::shared_ptr<arrow::ArrayVector> v;
532 while (true) {
533 auto s = reader.ReadNext(&batch);
534 if (!s.ok()) {
535 throw runtime_error_f("Cannot read batches from table %s", s.ToString().c_str());
536 }
537 if (batch == nullptr) {
538 break;
539 }
540 s = gprojector->Evaluate(*batch, arrow::default_memory_pool(), v.get());
541 if (!s.ok()) {
542 throw runtime_error_f("Cannot apply projector %s", s.ToString().c_str());
543 }
544 }
545 return v;
546}
547
548gandiva::NodePtr createExpressionTree(Operations const& opSpecs,
549 gandiva::SchemaPtr const& Schema)
550{
551 std::vector<gandiva::NodePtr> opNodes;
552 opNodes.resize(opSpecs.size());
553 std::fill(opNodes.begin(), opNodes.end(), nullptr);
554 std::unordered_map<std::string, gandiva::NodePtr> fieldNodes;
555 std::unordered_map<size_t, gandiva::NodePtr> subtrees;
556
557 auto datumNode = [Schema, &opNodes, &fieldNodes](DatumSpec const& spec) {
558 if (spec.datum.index() == 0) {
559 return gandiva::NodePtr(nullptr);
560 }
561 if (spec.datum.index() == 1) {
562 return opNodes[std::get<size_t>(spec.datum)];
563 }
564
565 if (spec.datum.index() == 2) {
566 auto content = std::get<LiteralNode::var_t>(spec.datum);
567 switch (content.index()) {
568 case 0: // int
569 return gandiva::TreeExprBuilder::MakeLiteral(static_cast<int32_t>(std::get<int>(content)));
570 case 1: // bool
571 return gandiva::TreeExprBuilder::MakeLiteral(std::get<bool>(content));
572 case 2: // float
573 return gandiva::TreeExprBuilder::MakeLiteral(std::get<float>(content));
574 case 3: // double
575 return gandiva::TreeExprBuilder::MakeLiteral(std::get<double>(content));
576 case 4: // uint8
577 return gandiva::TreeExprBuilder::MakeLiteral(std::get<uint8_t>(content));
578 case 5: // int64
579 return gandiva::TreeExprBuilder::MakeLiteral(std::get<int64_t>(content));
580 case 6: // int16
581 return gandiva::TreeExprBuilder::MakeLiteral(std::get<int16_t>(content));
582 case 7: // uint16
583 return gandiva::TreeExprBuilder::MakeLiteral(std::get<uint16_t>(content));
584 case 8: // int8
585 return gandiva::TreeExprBuilder::MakeLiteral(std::get<int8_t>(content));
586 case 9: // uint32
587 return gandiva::TreeExprBuilder::MakeLiteral(std::get<uint32_t>(content));
588 case 10: // uint64
589 return gandiva::TreeExprBuilder::MakeLiteral(std::get<uint64_t>(content));
590 default:
591 throw runtime_error("Malformed LiteralNode");
592 }
593 }
594
595 if (spec.datum.index() == 3) {
596 auto name = std::get<std::string>(spec.datum);
597 auto lookup = fieldNodes.find(name);
598 if (lookup != fieldNodes.end()) {
599 return lookup->second;
600 }
601 auto field = Schema->GetFieldByName(name);
602 if (field == nullptr) {
603 throw runtime_error_f("Cannot find field \"%s\"", name.c_str());
604 }
605 auto node = gandiva::TreeExprBuilder::MakeField(field);
606 fieldNodes.insert({name, node});
607 return node;
608 }
609 throw runtime_error("Malformed DatumSpec");
610 };
611
612 gandiva::NodePtr tree = nullptr;
613 for (auto it = opSpecs.rbegin(); it != opSpecs.rend(); ++it) {
614 auto leftNode = datumNode(it->left);
615 auto rightNode = datumNode(it->right);
616 auto condNode = datumNode(it->condition);
617
618 auto insertUpcastNode = [](gandiva::NodePtr node, atype::type t0, atype::type t) {
619 if (t != t0) {
620 auto upcast = gandiva::TreeExprBuilder::MakeFunction(upcastTo(t0), {node}, concreteArrowType(t0));
621 node = upcast;
622 }
623 return node;
624 };
625
626 auto insertEqualizeUpcastNode = [](gandiva::NodePtr& node1, gandiva::NodePtr& node2, atype::type t1, atype::type t2) {
627 if (t2 > t1) {
628 auto upcast = gandiva::TreeExprBuilder::MakeFunction(upcastTo(t2), {node1}, concreteArrowType(t2));
629 node1 = upcast;
630 } else if (t1 > t2) {
631 auto upcast = gandiva::TreeExprBuilder::MakeFunction(upcastTo(t1), {node2}, concreteArrowType(t1));
632 node2 = upcast;
633 }
634 };
635
636 gandiva::NodePtr temp_node;
637
638 switch (it->op) {
640 temp_node = gandiva::TreeExprBuilder::MakeOr({leftNode, rightNode});
641 break;
643 temp_node = gandiva::TreeExprBuilder::MakeAnd({leftNode, rightNode});
644 break;
646 temp_node = gandiva::TreeExprBuilder::MakeIf(condNode, leftNode, rightNode, concreteArrowType(it->type));
647 break;
648 default:
649 if (it->op < BasicOp::Sqrt) {
650 if (it->type != atype::BOOL) {
651 leftNode = insertUpcastNode(leftNode, it->type, it->left.type);
652 rightNode = insertUpcastNode(rightNode, it->type, it->right.type);
653 } else if (it->op == BasicOp::Equal || it->op == BasicOp::NotEqual) {
654 insertEqualizeUpcastNode(leftNode, rightNode, it->left.type, it->right.type);
655 }
656 temp_node = gandiva::TreeExprBuilder::MakeFunction(basicOperationsMap[it->op], {leftNode, rightNode}, concreteArrowType(it->type));
657 } else {
658 leftNode = insertUpcastNode(leftNode, it->type, it->left.type);
659 temp_node = gandiva::TreeExprBuilder::MakeFunction(basicOperationsMap[it->op], {leftNode}, concreteArrowType(it->type));
660 }
661 break;
662 }
663 if (it->index == 0) {
664 tree = temp_node;
665 } else {
666 auto subtree = subtrees.find(it->index);
667 if (subtree == subtrees.end()) {
668 subtrees.insert({it->index, temp_node});
669 } else {
670 subtree->second = temp_node;
671 }
672 }
673 opNodes[std::get<size_t>(it->result.datum)] = temp_node;
674 }
675
676 return tree;
677}
678
679bool isTableCompatible(std::set<uint32_t> const& hashes, Operations const& specs)
680{
681 std::set<uint32_t> opHashes;
682 for (auto const& spec : specs) {
683 if (spec.left.datum.index() == 3) {
684 opHashes.insert(spec.left.hash);
685 }
686 if (spec.right.datum.index() == 3) {
687 opHashes.insert(spec.right.hash);
688 }
689 }
690
691 return std::includes(hashes.begin(), hashes.end(),
692 opHashes.begin(), opHashes.end());
693}
694
695void updateExpressionInfos(expressions::Filter const& filter, std::vector<ExpressionInfo>& eInfos)
696{
697 if (eInfos.empty()) {
698 throw runtime_error("Empty expression info vector.");
699 }
701 for (auto& info : eInfos) {
702 if (isTableCompatible(info.hashes, ops)) {
703 auto tree = createExpressionTree(ops, info.schema);
705 if (info.tree != nullptr) {
706 info.tree = gandiva::TreeExprBuilder::MakeAnd({info.tree, tree});
707 } else {
708 info.tree = tree;
709 }
710 }
711 }
712}
713
714void updateFilterInfo(ExpressionInfo& info, std::shared_ptr<arrow::Table>& table)
715{
716 if (info.tree != nullptr && info.filter == nullptr) {
718 }
719 if (info.tree != nullptr && info.filter != nullptr && info.resetSelection == true) {
721 info.resetSelection = false;
722 }
723}
724
725} // namespace o2::framework::expressions
#define O2_BUILTIN_UNREACHABLE
uint8_t lookup(const char input) noexcept
uint32_t gfilter
Definition RawData.h:6
GLdouble n
Definition glcorearb.h:1982
GLuint64EXT * result
Definition glcorearb.h:5662
const GLdouble * v
Definition glcorearb.h:832
GLuint index
Definition glcorearb.h:781
GLdouble GLdouble GLdouble GLdouble top
Definition glcorearb.h:4077
GLuint const GLchar * name
Definition glcorearb.h:781
GLdouble GLdouble right
Definition glcorearb.h:4077
GLdouble f
Definition glcorearb.h:310
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLint left
Definition glcorearb.h:1979
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition glcorearb.h:1308
GLsizei const GLchar *const * path
Definition glcorearb.h:3591
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition glcorearb.h:5034
std::shared_ptr< gandiva::SelectionVector > Selection
Definition Expressions.h:47
std::shared_ptr< arrow::DataType > concreteArrowType(atype::type type)
std::shared_ptr< gandiva::Filter > createFilter(gandiva::SchemaPtr const &Schema, gandiva::ConditionPtr condition)
Function to create gandiva filter from gandiva condition.
gandiva::ExpressionPtr makeExpression(gandiva::NodePtr node, gandiva::FieldPtr result)
Function to create gandiva projecting expression from generic gandiva expression tree.
std::shared_ptr< gandiva::Projector > createProjectorHelper(size_t nColumns, expressions::Projector *projectors, std::shared_ptr< arrow::Schema > schema, std::vector< std::shared_ptr< arrow::Field > > const &fields)
gandiva::Selection createSelection(std::shared_ptr< arrow::Table > const &table, Filter const &expression)
Function for creating gandiva selection from our internal filter tree.
bool operator==(DatumSpec const &lhs, DatumSpec const &rhs)
auto createProjection(std::shared_ptr< arrow::Table > const &table, std::shared_ptr< gandiva::Projector > const &gprojector)
const char * stringType(atype::type t)
std::vector< ColumnOperationSpec > Operations
void updateExpressionInfos(expressions::Filter const &filter, std::vector< ExpressionInfo > &eInfos)
Function for attaching gandiva filters to to compatible task inputs.
constexpr auto makeDatum(T const &)
Operations createOperations(Filter const &expression)
Function to create an internal operation sequence from a filter tree.
std::ostream & operator<<(std::ostream &os, DatumSpec const &spec)
gandiva::ConditionPtr makeCondition(gandiva::NodePtr node)
Function to create gandiva condition expression from generic gandiva expression tree.
bool isTableCompatible(std::set< uint32_t > const &hashes, Operations const &specs)
Function to check compatibility of a given arrow schema with operation sequence.
void unknownParameterUsed(const char *name)
void walk(Node *head, L &&pred)
Tree-walker helper.
gandiva::NodePtr createExpressionTree(Operations const &opSpecs, gandiva::SchemaPtr const &Schema)
Function to create gandiva expression tree from operation sequence.
constexpr auto makeOp(T const &, size_t const &)
void updatePlaceholders(Filter &filter, InitContext &context)
Update placeholder nodes from context.
std::string upcastTo(atype::type f)
std::shared_ptr< gandiva::Projector > createProjector(gandiva::SchemaPtr const &Schema, Operations const &opSpecs, gandiva::FieldPtr result)
Function to create gandiva projector from operation sequence.
void updateFilterInfo(ExpressionInfo &info, std::shared_ptr< arrow::Table > &table)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
RuntimeErrorRef runtime_error(const char *)
RuntimeErrorRef runtime_error_f(const char *,...)
gandiva::Selection selection
Definition Expressions.h:66
gandiva::FilterPtr filter
Definition Expressions.h:65
gandiva::NodePtr tree
Definition Expressions.h:64
A struct, containing the root of the expression tree.
size_t designateSubtrees(Node *node, size_t index=0)
std::unique_ptr< Node > node
LiteralValue::stored_type var_t
From https://en.cppreference.com/w/cpp/utility/variant/visit.
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))