Project
Loading...
Searching...
No Matches
Expressions.h File Reference
#include "Framework/BasicOps.h"
#include "Framework/CompilerBuiltins.h"
#include "Framework/Pack.h"
#include "Framework/Configurable.h"
#include "Framework/Variant.h"
#include "Framework/InitContext.h"
#include "Framework/ConfigParamRegistry.h"
#include "Framework/RuntimeError.h"
#include <arrow/type_fwd.h>
#include <gandiva/gandiva_aliases.h>
#include <arrow/type.h>
#include <gandiva/arrow.h>
#include <arrow/table.h>
#include <gandiva/selection_vector.h>
#include <gandiva/node.h>
#include <gandiva/filter.h>
#include <gandiva/projector.h>
#include <variant>
#include <string>
#include <memory>
#include <set>

Go to the source code of this file.

Classes

struct  ExpressionInfo
 
struct  o2::framework::expressions::LiteralStorage< T >
 
struct  o2::framework::expressions::LiteralNode
 An expression tree node corresponding to a literal value. More...
 
struct  o2::framework::expressions::BindingNode
 An expression tree node corresponding to a column binding. More...
 
struct  o2::framework::expressions::OpNode
 An expression tree node corresponding to binary or unary operation. More...
 
struct  o2::framework::expressions::PlaceholderNode
 A placeholder node for simple type configurable. More...
 
struct  o2::framework::expressions::ConditionalNode
 A conditional node. More...
 
struct  o2::framework::expressions::Node
 A generic tree node. More...
 
struct  o2::framework::expressions::Filter
 A struct, containing the root of the expression tree. More...
 

Namespaces

namespace  gandiva
 
namespace  o2
 a couple of static helper functions to create timestamp values for CCDB queries or override obsolete objects
 
namespace  o2::framework
 Defining PrimaryVertex explicitly as messageable.
 
namespace  o2::framework::expressions
 

Concepts

concept  o2::framework::expressions::is_filter
 

Macros

#define SELECT_ARROW_TYPE(_Ctype_, _Atype_)
 
#define BINARY_OP_NODES(_operator_, _operation_)
 overloaded operators to build the tree from an expression
 
#define BINARY_FUNC_NODES(_func_, _node_)
 
#define ncheckbit(_node_, _bit_)   ((_node_ & _bit_) == _bit_)
 
#define UNARY_FUNC_NODES(_func_, _node_)
 unary functions on nodes
 

Typedefs

using gandiva::Selection = std::shared_ptr< gandiva::SelectionVector >
 
using gandiva::FilterPtr = std::shared_ptr< gandiva::Filter >
 
using atype = arrow::Type
 
using o2::framework::expressions::LiteralValue = LiteralStorage< int, bool, float, double, uint8_t, int64_t, int16_t, uint16_t, int8_t, uint32_t, uint64_t >
 
using o2::framework::expressions::Projector = Filter
 
using o2::framework::expressions::Operations = std::vector< ColumnOperationSpec >
 

Functions

const charo2::framework::expressions::stringType (atype::type t)
 
template<typename T >
constexpr auto o2::framework::expressions::selectArrowType ()
 
 o2::framework::expressions::SELECT_ARROW_TYPE (bool, BOOL)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (float, FLOAT)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (double, DOUBLE)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (uint8_t, UINT8)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (int8_t, INT8)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (uint16_t, UINT16)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (int16_t, INT16)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (uint32_t, UINT32)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (int32_t, INT32)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (uint64_t, UINT64)
 
 o2::framework::expressions::SELECT_ARROW_TYPE (int64_t, INT64)
 
std::shared_ptr< arrow::DataType > o2::framework::expressions::concreteArrowType (atype::type type)
 
std::string o2::framework::expressions::upcastTo (atype::type f)
 
 o2::framework::expressions::BINARY_OP_NODES (|, BitwiseOr)
 
 o2::framework::expressions::BINARY_OP_NODES (+, Addition)
 
 o2::framework::expressions::BINARY_OP_NODES (-, Subtraction)
 
 o2::framework::expressions::BINARY_OP_NODES (/, Division)
 
 o2::framework::expressions::BINARY_OP_NODES (>, GreaterThan)
 
 o2::framework::expressions::BINARY_OP_NODES (>=, GreaterThanOrEqual)
 
 o2::framework::expressions::BINARY_OP_NODES (<, LessThan)
 
 o2::framework::expressions::BINARY_OP_NODES (<=, LessThanOrEqual)
 
 o2::framework::expressions::BINARY_OP_NODES (==, Equal)
 
 o2::framework::expressions::BINARY_OP_NODES (!=, NotEqual)
 
 o2::framework::expressions::BINARY_OP_NODES (||, LogicalOr)
 
template<typename T >
requires (std::is_arithmetic_v<T>)
Node o2::framework::expressions::npow (Node &&left, T right)
 functions
 
 o2::framework::expressions::BINARY_FUNC_NODES (Atan2, natan2)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Round, nround)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Sqrt, nsqrt)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Exp, nexp)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Log, nlog)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Log10, nlog10)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Abs, nabs)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Sin, nsin)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Cos, ncos)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Tan, ntan)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Asin, nasin)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Acos, nacos)
 
 o2::framework::expressions::UNARY_FUNC_NODES (Atan, natan)
 
 o2::framework::expressions::UNARY_FUNC_NODES (BitwiseNot, nbitwise_not)
 
Node o2::framework::expressions::ifnode (Node &&condition_, Node &&then_, Node &&else_)
 conditionals
 
template<typename L >
requires (std::is_arithmetic_v<L>)
Node o2::framework::expressions::ifnode (Node &&condition_, Node &&then_, L else_)
 
template<typename L >
requires (std::is_arithmetic_v<L>)
Node o2::framework::expressions::ifnode (Node &&condition_, L then_, Node &&else_)
 
template<typename L1 , typename L2 >
requires (std::is_arithmetic_v<L1>&& std::is_arithmetic_v<L2>)
Node o2::framework::expressions::ifnode (Node &&condition_, L1 then_, L2 else_)
 
template<typename T >
Node o2::framework::expressions::ifnode (Configurable< T > const &condition_, Node &&then_, Node &&else_)
 
template<typename L >
Node o2::framework::expressions::ifnode (Node &&condition_, Node &&then_, Configurable< L > const &else_)
 
template<typename L >
Node o2::framework::expressions::ifnode (Node &&condition_, Configurable< L > const &then_, Node &&else_)
 
template<typename L1 , typename L2 >
Node o2::framework::expressions::ifnode (Node &&condition_, Configurable< L1 > const &then_, Configurable< L2 > const &else_)
 
gandiva::Selection o2::framework::expressions::createSelection (std::shared_ptr< arrow::Table > const &table, Filter const &expression)
 Function for creating gandiva selection from our internal filter tree.
 
gandiva::Selection o2::framework::expressions::createSelection (std::shared_ptr< arrow::Table > const &table, std::shared_ptr< gandiva::Filter > const &gfilter)
 Function for creating gandiva selection from prepared gandiva expressions tree.
 
Operations o2::framework::expressions::createOperations (Filter const &expression)
 Function to create an internal operation sequence from a filter tree.
 
bool o2::framework::expressions::isTableCompatible (std::set< uint32_t > const &hashes, Operations const &specs)
 Function to check compatibility of a given arrow schema with operation sequence.
 
gandiva::NodePtr o2::framework::expressions::createExpressionTree (Operations const &opSpecs, gandiva::SchemaPtr const &Schema)
 Function to create gandiva expression tree from operation sequence.
 
std::shared_ptr< gandiva::Filter > o2::framework::expressions::createFilter (gandiva::SchemaPtr const &Schema, gandiva::ConditionPtr condition)
 Function to create gandiva filter from gandiva condition.
 
std::shared_ptr< gandiva::Filter > o2::framework::expressions::createFilter (gandiva::SchemaPtr const &Schema, Operations const &opSpecs)
 Function to create gandiva filter from operation sequence.
 
std::shared_ptr< gandiva::Projector > o2::framework::expressions::createProjector (gandiva::SchemaPtr const &Schema, Operations const &opSpecs, gandiva::FieldPtr result)
 Function to create gandiva projector from operation sequence.
 
std::shared_ptr< gandiva::Projector > o2::framework::expressions::createProjector (gandiva::SchemaPtr const &Schema, Projector &&p, gandiva::FieldPtr result)
 Function to create gandiva projector directly from expression.
 
void o2::framework::expressions::updateExpressionInfos (expressions::Filter const &filter, std::vector< ExpressionInfo > &eInfos)
 Function for attaching gandiva filters to to compatible task inputs.
 
gandiva::ConditionPtr o2::framework::expressions::makeCondition (gandiva::NodePtr node)
 Function to create gandiva condition expression from generic gandiva expression tree.
 
gandiva::ExpressionPtr o2::framework::expressions::makeExpression (gandiva::NodePtr node, gandiva::FieldPtr result)
 Function to create gandiva projecting expression from generic gandiva expression tree.
 
void o2::framework::expressions::updatePlaceholders (Filter &filter, InitContext &context)
 Update placeholder nodes from context.
 
template<typename... C>
std::vector< expressions::Projectoro2::framework::expressions::makeProjectors (framework::pack< C... >)
 
std::shared_ptr< gandiva::Projector > o2::framework::expressions::createProjectorHelper (size_t nColumns, expressions::Projector *projectors, std::shared_ptr< arrow::Schema > schema, std::vector< std::shared_ptr< arrow::Field > > const &fields)
 
template<typename... C>
std::shared_ptr< gandiva::Projector > o2::framework::expressions::createProjectors (framework::pack< C... >, std::vector< std::shared_ptr< arrow::Field > > const &fields, gandiva::SchemaPtr schema)
 
void o2::framework::expressions::updateFilterInfo (ExpressionInfo &info, std::shared_ptr< arrow::Table > &table)
 

Variables

BINARY_OP_NODESo2::framework::expressions::BitwiseAnd
 
BINARY_OP_NODESo2::framework::expressions::BitwiseXor
 
BINARY_OP_NODESo2::framework::expressions::Multiplication
 
BINARY_OP_NODES && o2::framework::expressions::LogicalAnd
 

Macro Definition Documentation

◆ BINARY_FUNC_NODES

#define BINARY_FUNC_NODES (   _func_,
  _node_ 
)

Definition at line 282 of file Expressions.h.

◆ BINARY_OP_NODES

#define BINARY_OP_NODES (   _operator_,
  _operation_ 
)

overloaded operators to build the tree from an expression

Definition at line 211 of file Expressions.h.

◆ ncheckbit

#define ncheckbit (   _node_,
  _bit_ 
)    ((_node_ & _bit_) == _bit_)

Definition at line 334 of file Expressions.h.

◆ SELECT_ARROW_TYPE

#define SELECT_ARROW_TYPE (   _Ctype_,
  _Atype_ 
)
Value:
template <typename T> \
requires std::same_as<T, _Ctype_> \
constexpr auto selectArrowType() \
{ \
return atype::_Atype_; \
}

Definition at line 87 of file Expressions.h.

◆ UNARY_FUNC_NODES

#define UNARY_FUNC_NODES (   _func_,
  _node_ 
)
Value:
inline Node _node_(Node&& arg) \
{ \
return Node{OpNode{BasicOp::_func_}, std::forward<Node>(arg)}; \
}

unary functions on nodes

Definition at line 337 of file Expressions.h.

Typedef Documentation

◆ atype

using atype = arrow::Type

Definition at line 50 of file Expressions.h.