Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
This is the superclass of all expr evaluation nodes. More...
#include <expr.h>
Static Public Member Functions | |
static Status | CreateExprTree (ObjectPool *pool, const TExpr &texpr, ExprContext **ctx) |
static Status | CreateExprTrees (ObjectPool *pool, const std::vector< TExpr > &texprs, std::vector< ExprContext * > *ctxs) |
static Status | Prepare (const std::vector< ExprContext * > &ctxs, RuntimeState *state, const RowDescriptor &row_desc, MemTracker *tracker) |
static Status | Open (const std::vector< ExprContext * > &ctxs, RuntimeState *state) |
Convenience function for opening multiple expr trees. More... | |
static Status | Clone (const std::vector< ExprContext * > &ctxs, RuntimeState *state, std::vector< ExprContext * > *new_ctxs) |
static void | Close (const std::vector< ExprContext * > &ctxs, RuntimeState *state) |
Convenience function for closing multiple expr trees. More... | |
static Expr * | CreateLiteral (ObjectPool *pool, const ColumnType &type, void *data) |
static Expr * | CreateLiteral (ObjectPool *pool, const ColumnType &type, const std::string &) |
static int | ComputeResultsLayout (const std::vector< Expr * > &exprs, std::vector< int > *offsets, int *var_result_begin) |
static int | ComputeResultsLayout (const std::vector< ExprContext * > &ctxs, std::vector< int > *offsets, int *var_result_begin) |
static std::string | DebugString (const std::vector< Expr * > &exprs) |
static std::string | DebugString (const std::vector< ExprContext * > &ctxs) |
static void | InitBuiltinsDummy () |
Static Public Attributes | |
static const char * | LLVM_CLASS_NAME = "class.impala::Expr" |
Protected Member Functions | |
Expr (const ColumnType &type, bool is_slotref=false) | |
Expr (const TExprNode &node, bool is_slotref=false) | |
virtual Status | Prepare (RuntimeState *state, const RowDescriptor &row_desc, ExprContext *context) |
virtual Status | Open (RuntimeState *state, ExprContext *context, FunctionContext::FunctionStateScope scope=FunctionContext::FRAGMENT_LOCAL) |
virtual void | Close (RuntimeState *state, ExprContext *context, FunctionContext::FunctionStateScope scope=FunctionContext::FRAGMENT_LOCAL) |
Subclasses overriding this function should call Expr::Close(). More... | |
FunctionContext * | RegisterFunctionContext (ExprContext *ctx, RuntimeState *state, int varargs_buffer_size=0) |
llvm::Function * | CreateIrFunctionPrototype (LlvmCodeGen *codegen, const std::string &name, llvm::Value *(*args)[2]) |
Status | GetCodegendComputeFnWrapper (RuntimeState *state, llvm::Function **fn) |
llvm::Function * | GetStaticGetValWrapper (ColumnType type, LlvmCodeGen *codegen) |
std::string | DebugString (const std::string &expr_name) const |
Simple debug string that provides no expr subclass-specific information. More... | |
Protected Attributes | |
LibCache::LibCacheEntry * | cache_entry_ |
Cache entry for the library implementing this function. More... | |
TFunction | fn_ |
Function description. More... | |
const bool | is_slotref_ |
recognize if this node is a slotref in order to speed up GetValue() More... | |
const ColumnType | type_ |
analysis is done, types are fixed at this point More... | |
std::vector< Expr * > | children_ |
int | output_scale_ |
int | context_index_ |
llvm::Function * | ir_compute_fn_ |
Cached codegened compute function. Exprs should set this in GetCodegendComputeFn(). More... | |
boost::scoped_ptr< AnyVal > | constant_val_ |
Static Private Member Functions | |
static Status | CreateExpr (ObjectPool *pool, const TExprNode &texpr_node, Expr **expr) |
Create a new Expr based on texpr_node.node_type within 'pool'. More... | |
static Status | CreateTreeFromThrift (ObjectPool *pool, const std::vector< TExprNode > &nodes, Expr *parent, int *node_idx, Expr **root_expr, ExprContext **ctx) |
static BooleanVal | GetBooleanVal (Expr *expr, ExprContext *context, TupleRow *row) |
static TinyIntVal | GetTinyIntVal (Expr *expr, ExprContext *context, TupleRow *row) |
static SmallIntVal | GetSmallIntVal (Expr *expr, ExprContext *context, TupleRow *row) |
static IntVal | GetIntVal (Expr *expr, ExprContext *context, TupleRow *row) |
static BigIntVal | GetBigIntVal (Expr *expr, ExprContext *context, TupleRow *row) |
static FloatVal | GetFloatVal (Expr *expr, ExprContext *context, TupleRow *row) |
static DoubleVal | GetDoubleVal (Expr *expr, ExprContext *context, TupleRow *row) |
static StringVal | GetStringVal (Expr *expr, ExprContext *context, TupleRow *row) |
static TimestampVal | GetTimestampVal (Expr *expr, ExprContext *context, TupleRow *row) |
static DecimalVal | GetDecimalVal (Expr *expr, ExprContext *context, TupleRow *row) |
Friends | |
class | AggFnEvaluator |
class | CastExpr |
class | ComputeFunctions |
class | DecimalFunctions |
class | DecimalLliteral |
class | DecimalOperators |
class | MathFunctions |
class | StringFunctions |
class | TimestampFunctions |
class | ConditionalFunctions |
class | UtilityFunctions |
class | CaseExpr |
class | InPredicate |
class | FunctionCall |
class | ScalarFnCall |
class | ExprContext |
class | ExprTest |
|
virtual |
Definition at line 110 of file expr.cc.
References cache_entry_.
|
protected |
|
protected |
|
inline |
Definition at line 141 of file expr.h.
Referenced by CreateTreeFromThrift().
|
inline |
Definition at line 148 of file expr.h.
Referenced by impala::CaseExpr::GetChildVal(), and impala::CaseExpr::GetCodegendComputeFn().
|
static |
Clones each ExprContext for multiple expr trees. 'new_ctxs' should be an empty vector, and a clone of each context in 'ctxs' will be added to it. The new ExprContexts are created in state->obj_pool().
Definition at line 374 of file expr.cc.
References impala::Status::OK, and RETURN_IF_ERROR.
Referenced by impala::HdfsScanNode::GetConjunctCtxs(), and impala::SortExecExprs::Open().
|
static |
Convenience function for closing multiple expr trees.
Referenced by impala::UnionNode::Close(), impala::SortExecExprs::Close(), impala::CaseExpr::Close(), impala::HashJoinNode::Close(), impala::AggregationNode::Close(), impala::ScalarFnCall::Close(), impala::ExprContext::Close(), impala::HiveUdfCall::Close(), impala::PartitionedHashJoinNode::Close(), impala::DataStreamSender::Close(), impala::PartitionedAggregationNode::Close(), impala::AggFnEvaluator::Close(), impala::HdfsScanner::Close(), impala::ExecNode::Close(), impala::HdfsScanNode::Close(), impala::HdfsTableSink::Close(), impala::HdfsPartitionDescriptor::CloseExprs(), impala::ImpalaServer::QueryExecState::Done(), impala::OldHashTableTest::TearDown(), and impala::HashTableTest::TearDown().
|
protectedvirtual |
Subclasses overriding this function should call Expr::Close().
If scope if FRAGMENT_LOCAL, both fragment- and thread-local state should be torn down. Otherwise, if scope is THREAD_LOCAL, only thread-local state should be torn down.
Reimplemented in impala::HiveUdfCall, impala::ScalarFnCall, and impala::CaseExpr.
Definition at line 114 of file expr.cc.
References cache_entry_, children_, impala::LibCache::DecrementUseCount(), and impala::LibCache::instance().
|
static |
Computes a memory efficient layout for storing the results of evaluating 'exprs' Returns the number of bytes necessary to store all the results and offsets where the result for each expr should be stored. Variable length types are guaranteed to be at the end and 'var_result_begin' will be set the beginning byte offset where variable length results begin. 'var_result_begin' will be set to -1 if there are no variable len types.
Referenced by impala::HashTableCtx::HashTableCtx(), and impala::OldHashTable::OldHashTable().
|
static |
|
staticprivate |
Create a new Expr based on texpr_node.node_type within 'pool'.
Definition at line 190 of file expr.cc.
References impala::ObjectPool::Add(), CaseExpr, impala::Status::OK, and ScalarFnCall.
Referenced by CreateTreeFromThrift().
|
static |
Create expression tree from the list of nodes contained in texpr within 'pool'. Returns the root of expression tree in 'expr' and the corresponding ExprContext in 'ctx'.
Definition at line 129 of file expr.cc.
References CreateTreeFromThrift(), impala::Status::GetDetail(), impala::Status::OK, and impala::Status::ok().
Referenced by CreateExprTrees(), impala::HdfsPartitionDescriptor::HdfsPartitionDescriptor(), impala::HashJoinNode::Init(), impala::AnalyticEvalNode::Init(), impala::PartitionedHashJoinNode::Init(), and Java_com_cloudera_impala_service_FeSupport_NativeEvalConstExprs().
|
static |
Creates vector of ExprContexts containing exprs from the given vector of TExprs within 'pool'. Returns an error if any of the individual conversions caused an error, otherwise OK.
Definition at line 149 of file expr.cc.
References CreateExprTree(), impala::Status::OK, and RETURN_IF_ERROR.
Referenced by impala::DataStreamSender::DataStreamSender(), impala::UnionNode::Init(), impala::HashJoinNode::Init(), impala::AggregationNode::Init(), impala::ExecNode::Init(), impala::PartitionedHashJoinNode::Init(), impala::PartitionedAggregationNode::Init(), impala::HdfsScanNode::Prepare(), and impala::HdfsTableSink::Prepare().
|
protected |
Helper function to create an empty Function* with the appropriate signature to be returned by GetCodegendComputeFn(). 'name' is the name of the returned Function*. The arguments to the function are returned in 'args'.
Definition at line 456 of file expr.cc.
References impala::LlvmCodeGen::FnPrototype::AddArgument(), impala::LlvmCodeGen::FnPrototype::GeneratePrototype(), impala::CodegenAnyVal::GetLoweredType(), impala::LlvmCodeGen::GetPtrType(), impala::TupleRow::LLVM_CLASS_NAME, impala::ExprContext::LLVM_CLASS_NAME, and type().
Referenced by impala::CaseExpr::GetCodegendComputeFn(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), impala::ScalarFnCall::GetCodegendComputeFn(), and GetCodegendComputeFnWrapper().
|
static |
Create a new literal expr of 'type' with initial 'data'. data should match the ColumnType (i.e. type == TYPE_INT, data is a int*) The new Expr will be allocated from the pool.
|
static |
Create a new literal expr of 'type' by parsing the string. NULL will be returned if the string and type are not compatible. The new Expr will be allocated from the pool.
|
staticprivate |
Creates an expr tree for the node rooted at 'node_idx' via depth-first traversal. parameters nodes: vector of thrift expression nodes to be translated parent: parent of node at node_idx (or NULL for node_idx == 0) node_idx: in: root of TExprNode tree out: next node in 'nodes' that isn't part of tree root_expr: out: root of constructed expr tree ctx: out: context of constructed expr tree return status.ok() if successful !status.ok() if tree is inconsistent or corrupt
Definition at line 160 of file expr.cc.
References impala::ObjectPool::Add(), AddChild(), CreateExpr(), ExprContext, impala::Status::OK, and RETURN_IF_ERROR.
Referenced by impala::AggFnEvaluator::Create(), and CreateExprTree().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::IsNullExpr, impala::OrPredicate, impala::Literal, impala::CaseExpr, impala::AndPredicate, impala::ScalarFnCall, impala::NullLiteral, impala::TupleIsNullPredicate, and impala::SlotRef.
Definition at line 385 of file expr.cc.
References children_, impala::ColumnType::DebugString(), and type_.
Referenced by impala::HashJoinNode::AddToDebugString(), impala::PartitionedHashJoinNode::AddToDebugString(), impala::SlotRef::DebugString(), impala::SortNode::DebugString(), impala::TopNNode::DebugString(), impala::ScalarFnCall::DebugString(), impala::CaseExpr::DebugString(), impala::Literal::DebugString(), impala::AggregationNode::DebugString(), impala::AnalyticEvalNode::DebugString(), impala::HiveUdfCall::DebugString(), impala::PartitionedAggregationNode::DebugString(), impala::HdfsTableSink::DebugString(), GetBigIntVal(), GetBooleanVal(), GetDecimalVal(), GetDoubleVal(), GetFloatVal(), GetIntVal(), GetSmallIntVal(), GetStringVal(), GetTimestampVal(), and GetTinyIntVal().
|
static |
|
static |
|
inlineprotected |
Simple debug string that provides no expr subclass-specific information.
Definition at line 332 of file expr.h.
References impala_udf::DebugString().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 589 of file expr.cc.
References DebugString().
Referenced by impala::ExprContext::GetBigIntVal(), GetBigIntVal(), GetConstVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 54 of file expr-ir.cc.
References GetBigIntVal().
|
virtual |
Virtual compute functions for each *Val type. Each Expr subclass should implement the functions for the return type(s) it supports. For example, a boolean function will only implement GetBooleanVal(). Some Exprs, like Literal, have many possible return types and will implement multiple Get*Val() functions.
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::OrPredicate, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::TupleIsNullPredicate, impala::AndPredicate, impala::CaseExpr, and impala::NullLiteral.
Definition at line 573 of file expr.cc.
References DebugString().
Referenced by impala::ExprContext::GetBooleanVal(), GetBooleanVal(), GetConstVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Static wrappers around the virtual Get*Val() functions. Calls the appropriate Get*Val() function on expr, passing it the context and row arguments. These are used to call Get*Val() functions from generated functions, since I don't know how to call virtual functions directly. GetStaticGetValWrapper() returns the IR function of the appropriate wrapper function.
Definition at line 42 of file expr-ir.cc.
References GetBooleanVal().
|
inline |
Definition at line 142 of file expr.h.
Referenced by impala::HiveUdfCall::Evaluate(), and impala::HiveUdfCall::Prepare().
|
pure virtual |
Returns an llvm::Function* with signature: <subclass of="" anyval>=""> ComputeFn(ExprContext* context, TupleRow* row) The function should evaluate this expr over 'row' and return the result as the appropriate type of AnyVal.
Implemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::IsNullExpr, impala::OrPredicate, impala::ScalarFnCall, impala::Literal, impala::AndPredicate, impala::SlotRef, impala::TupleIsNullPredicate, impala::CaseExpr, and impala::NullLiteral.
Referenced by impala::AggregationNode::CodegenUpdateSlot(), and impala::PartitionedAggregationNode::CodegenUpdateSlot().
|
protected |
Generates an IR compute function that calls the appropriate interpreted Get*Val() compute function. This is useful for builtins that can't be implemented with the UDF interface (e.g. functions that need short-circuiting) and that don't have custom codegen functions that use the IRBuilder. It doesn't provide any performance benefit over the interpreted path. TODO: this should be replaced with fancier xcompiling infrastructure
Definition at line 546 of file expr.cc.
References impala::LlvmCodeGen::CastPtrToLlvmPtr(), impala::LlvmCodeGen::context(), impala::CodegenAnyVal::CreateCall(), CreateIrFunctionPrototype(), impala::LlvmCodeGen::FinalizeFunction(), impala::RuntimeState::GetCodegen(), impala::LlvmCodeGen::GetPtrType(), GetStaticGetValWrapper(), ir_compute_fn_, LLVM_CLASS_NAME, impala::Status::OK, RETURN_IF_ERROR, and type().
Referenced by impala::TupleIsNullPredicate::GetCodegendComputeFn(), and impala::HiveUdfCall::GetCodegendComputeFn().
|
virtual |
If this expr is constant, evaluates the expr with no input row argument and returns the output. Returns NULL if the argument is not constant. The returned AnyVal* is owned by this expr. This should only be called after Open() has been called on this expr.
Definition at line 491 of file expr.cc.
References constant_val_, GetBigIntVal(), GetBooleanVal(), GetDecimalVal(), GetDoubleVal(), GetFloatVal(), GetIntVal(), GetSmallIntVal(), GetStringVal(), GetTimestampVal(), GetTinyIntVal(), IsConstant(), impala::ExprContext::opened_, impala::ColumnType::type, type(), type_, impala::TYPE_BIGINT, impala::TYPE_BOOLEAN, impala::TYPE_CHAR, impala::TYPE_DECIMAL, impala::TYPE_DOUBLE, impala::TYPE_FLOAT, impala::TYPE_INT, impala::TYPE_SMALLINT, impala::TYPE_STRING, impala::TYPE_TIMESTAMP, impala::TYPE_TINYINT, and impala::TYPE_VARCHAR.
Referenced by impala::ScalarFnCall::Open().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 609 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetDecimalVal(), GetDecimalVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 69 of file expr-ir.cc.
References GetDecimalVal().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 597 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetDoubleVal(), GetDoubleVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 60 of file expr-ir.cc.
References GetDoubleVal().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 593 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetFloatVal(), GetFloatVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 57 of file expr-ir.cc.
References GetFloatVal().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 585 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetIntVal(), GetIntVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 51 of file expr-ir.cc.
References GetIntVal().
|
inline |
Definition at line 143 of file expr.h.
Referenced by impala::HiveUdfCall::Evaluate(), impala::CaseExpr::GetCodegendComputeFn(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), impala::ScalarFnCall::GetCodegendComputeFn(), impala::HiveUdfCall::Open(), impala::ScalarFnCall::Prepare(), and impala::HiveUdfCall::Prepare().
|
virtual |
Returns the slots that are referenced by this expr tree in 'slot_ids'. Returns the number of slots added to the vector
Reimplemented in impala::SlotRef.
Definition at line 418 of file expr.cc.
References children_.
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 581 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetSmallIntVal(), GetSmallIntVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 48 of file expr-ir.cc.
References GetSmallIntVal().
|
protected |
Returns the IR version of the static Get*Val() wrapper function corresponding to 'type'. This is used for calling interpreted Get*Val() functions from codegen'd functions (e.g. in ScalarFnCall() when codegen is disabled).
Definition at line 426 of file expr.cc.
References impala::ColumnType::DebugString(), impala::LlvmCodeGen::GetFunction(), impala::ColumnType::type, impala::TYPE_BIGINT, impala::TYPE_BOOLEAN, impala::TYPE_CHAR, impala::TYPE_DECIMAL, impala::TYPE_DOUBLE, impala::TYPE_FLOAT, impala::TYPE_INT, impala::TYPE_SMALLINT, impala::TYPE_STRING, impala::TYPE_TIMESTAMP, impala::TYPE_TINYINT, and impala::TYPE_VARCHAR.
Referenced by impala::ScalarFnCall::GetCodegendComputeFn(), and GetCodegendComputeFnWrapper().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 601 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetStringVal(), GetStringVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 63 of file expr-ir.cc.
References GetStringVal().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 605 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetTimestampVal(), GetTimestampVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 66 of file expr-ir.cc.
References GetTimestampVal().
|
virtual |
Reimplemented in impala::CoalesceExpr, impala::IfExpr, impala::NullIfExpr, impala::HiveUdfCall, impala::ScalarFnCall, impala::IsNullExpr, impala::Literal, impala::SlotRef, impala::CaseExpr, and impala::NullLiteral.
Definition at line 577 of file expr.cc.
References DebugString().
Referenced by GetConstVal(), impala::ExprContext::GetTinyIntVal(), GetTinyIntVal(), and impala::ExprContext::GetValue().
|
staticprivate |
Definition at line 45 of file expr-ir.cc.
References GetTinyIntVal().
|
static |
The builtin functions are not called from anywhere in the code and the symbols are therefore not included in the binary. We call these functions by using dlsym. The compiler must think this function is callable to not strip these symbols.
Definition at line 470 of file expr.cc.
References impala::Operators::Add_IntVal_IntVal(), impala::CastFunctions::CastToBooleanVal(), impala::DecimalOperators::CastToDecimalVal(), impala::InPredicate::InIterate(), impala::AggregateFunctions::InitNull(), impala::IsNullPredicate::IsNull(), impala::StringFunctions::Length(), impala::LikePredicate::Like(), impala::CompoundPredicate::Not(), impala::ConditionalFunctions::NullIfZero(), impala::UdfBuiltins::Pi(), impala::MathFunctions::Pi(), impala::UtilityFunctions::Pid(), impala::DecimalFunctions::Precision(), and impala::TimestampFunctions::Year().
|
virtual |
Returns true if GetValue(NULL) can be called on this expr and always returns the same result (e.g., exprs that don't contain slotrefs). The default implementation returns true if all children are constant.
Reimplemented in impala::ScalarFnCall, impala::TupleIsNullPredicate, and impala::SlotRef.
Definition at line 411 of file expr.cc.
References children_.
Referenced by GetConstVal(), and impala::ScalarFnCall::IsConstant().
|
static |
Convenience function for opening multiple expr trees.
Referenced by impala::ExprContext::Clone(), impala::HashJoinNode::ConstructBuildSide(), impala::PartitionedHashJoinNode::ConstructBuildSide(), impala::UnionNode::Open(), impala::SortExecExprs::Open(), impala::ExprContext::Open(), impala::CaseExpr::Open(), impala::AggregationNode::Open(), impala::ScalarFnCall::Open(), impala::HiveUdfCall::Open(), impala::DataStreamSender::Open(), impala::ExecNode::Open(), impala::PartitionedAggregationNode::Open(), impala::AggFnEvaluator::Open(), impala::HdfsScanNode::Open(), impala::HdfsTableSink::Open(), Open(), impala::HdfsPartitionDescriptor::OpenExprs(), impala::OldHashTableTest::SetUp(), impala::HashTableTest::SetUp(), and impala::ImpalaServer::QueryExecState::WaitInternal().
|
protectedvirtual |
Initializes 'context' for execution. If scope if FRAGMENT_LOCAL, both fragment- and thread-local state should be initialized. Otherwise, if scope is THREAD_LOCAL, only thread-local state should be initialized. Subclasses overriding this function should call Expr::Open() to recursively call Open() on the expr tree.
Reimplemented in impala::HiveUdfCall, impala::ScalarFnCall, and impala::CaseExpr.
Definition at line 366 of file expr.cc.
References children_, impala::Status::OK, Open(), and RETURN_IF_ERROR.
|
inline |
Get the number of digits after the decimal that should be displayed for this value. Returns -1 if no scale has been specified (currently the scale is only set for doubles set by RoundUpTo). GetValue() must have already been called. TODO: is this still necessary?
|
static |
Convenience function for preparing multiple expr trees. Allocations from 'ctxs' will be counted against 'tracker'.
Referenced by impala::TupleIsNullPredicate::Prepare(), impala::UnionNode::Prepare(), impala::SortExecExprs::Prepare(), impala::ExprContext::Prepare(), impala::CaseExpr::Prepare(), impala::HashJoinNode::Prepare(), impala::AggregationNode::Prepare(), impala::ScalarFnCall::Prepare(), impala::HiveUdfCall::Prepare(), impala::PartitionedHashJoinNode::Prepare(), impala::DataStreamSender::Prepare(), impala::ExecNode::Prepare(), impala::AggFnEvaluator::Prepare(), impala::PartitionedAggregationNode::Prepare(), impala::HdfsScanNode::Prepare(), Prepare(), impala::HdfsTableSink::PrepareExprs(), impala::HdfsPartitionDescriptor::PrepareExprs(), impala::HashTableTest::SetUp(), and impala::OldHashTableTest::SetUp().
|
protectedvirtual |
Initializes this expr instance for execution. This does not include initializing state in the ExprContext; 'context' should only be used to register a FunctionContext via RegisterFunctionContext(). Any IR functions must be generated here. Subclasses overriding this function should call Expr::Prepare() to recursively call Prepare() on the expr tree.
Reimplemented in impala::HiveUdfCall, impala::ScalarFnCall, impala::CaseExpr, impala::TupleIsNullPredicate, and impala::SlotRef.
Definition at line 350 of file expr.cc.
References children_, impala::INVALID_TYPE, impala::Status::OK, Prepare(), RETURN_IF_ERROR, impala::ColumnType::type, and type_.
|
protected |
Helper function that calls ctx->Register(), sets context_index_, and returns the registered FunctionContext.
Definition at line 80 of file expr.cc.
References impala::AnyValUtil::ColumnTypeToTypeDesc(), impala::ExprContext::fn_context(), and impala::ExprContext::Register().
Referenced by impala::CaseExpr::Prepare(), and impala::HiveUdfCall::Prepare().
|
inline |
Definition at line 145 of file expr.h.
Referenced by impala::CaseExpr::AnyValEq(), impala::HdfsParquetTableWriter::BoolColumnWriter::BoolColumnWriter(), impala::AggregationNode::CodegenUpdateSlot(), impala::PartitionedAggregationNode::CodegenUpdateSlot(), impala::HdfsParquetTableWriter::ColumnWriter< T >::ColumnWriter(), CreateIrFunctionPrototype(), impala::Literal::DebugString(), impala::HiveUdfCall::Evaluate(), impala::ScalarFnCall::EvaluateChildren(), impala::CaseExpr::GetChildVal(), impala::CaseExpr::GetCodegendComputeFn(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), impala::ScalarFnCall::GetCodegendComputeFn(), GetCodegendComputeFnWrapper(), GetConstVal(), impala::Literal::GetDecimalVal(), impala::ScalarFnCall::GetUdf(), impala::Literal::Literal(), impala::ScalarFnCall::Open(), impala::HiveUdfCall::Open(), impala::ScalarFnCall::Prepare(), impala::HiveUdfCall::Prepare(), and impala::DataStreamSender::Send().
|
friend |
|
friend |
Definition at line 246 of file expr.h.
Referenced by CreateExpr().
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 339 of file expr.h.
Referenced by CreateTreeFromThrift().
|
friend |
|
friend |
|
friend |
Definition at line 249 of file expr.h.
Referenced by CreateExpr().
|
friend |
|
friend |
|
friend |
|
protected |
Cache entry for the library implementing this function.
Definition at line 281 of file expr.h.
Referenced by Close(), impala::ScalarFnCall::GetFunction(), impala::ScalarFnCall::GetUdf(), impala::ScalarFnCall::Prepare(), and ~Expr().
|
protected |
Definition at line 290 of file expr.h.
Referenced by Close(), DebugString(), impala::ScalarFnCall::EvaluateChildren(), impala::ScalarFnCall::GetCodegendComputeFn(), GetSlotIds(), impala::ScalarFnCall::GetUdf(), impala::ScalarFnCall::InterpretEval(), IsConstant(), impala::CaseExpr::Open(), impala::ScalarFnCall::Open(), Open(), impala::SlotRef::Prepare(), impala::TupleIsNullPredicate::Prepare(), impala::ScalarFnCall::Prepare(), and Prepare().
|
protected |
If this expr is constant, this will store and cache the value generated by GetConstVal().
Definition at line 303 of file expr.h.
Referenced by GetConstVal().
|
protected |
Index to pass to ExprContext::fn_context() to retrieve this expr's FunctionContext. Set in RegisterFunctionContext(). -1 if this expr does not need a FunctionContext and doesn't call RegisterFunctionContext().
Definition at line 296 of file expr.h.
Referenced by impala::CaseExpr::Close(), impala::ScalarFnCall::Close(), impala::HiveUdfCall::Close(), impala::HiveUdfCall::Evaluate(), impala::ScalarFnCall::EvaluateChildren(), impala::ScalarFnCall::GetCodegendComputeFn(), impala::ScalarFnCall::InterpretEval(), impala::CaseExpr::Open(), impala::ScalarFnCall::Open(), impala::HiveUdfCall::Open(), and impala::ScalarFnCall::Prepare().
|
protected |
Function description.
Definition at line 284 of file expr.h.
Referenced by impala::ScalarFnCall::DebugString(), impala::HiveUdfCall::DebugString(), impala::HiveUdfCall::Evaluate(), Expr(), impala::ScalarFnCall::GetFunction(), impala::ScalarFnCall::GetUdf(), impala::ScalarFnCall::IsConstant(), impala::ScalarFnCall::Open(), impala::HiveUdfCall::Open(), impala::ScalarFnCall::Prepare(), impala::HiveUdfCall::Prepare(), and impala::ScalarFnCall::ScalarFnCall().
|
protected |
Cached codegened compute function. Exprs should set this in GetCodegendComputeFn().
Definition at line 299 of file expr.h.
Referenced by impala::CaseExpr::GetCodegendComputeFn(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), impala::ScalarFnCall::GetCodegendComputeFn(), and GetCodegendComputeFnWrapper().
|
protected |
|
static |
Definition at line 232 of file expr.h.
Referenced by impala::ScalarFnCall::GetCodegendComputeFn(), and GetCodegendComputeFnWrapper().
|
protected |
Definition at line 291 of file expr.h.
Referenced by impala::ExprContext::GetValue(), and impala::ScalarFnCall::Open().
|
protected |
analysis is done, types are fixed at this point
Definition at line 289 of file expr.h.
Referenced by impala::Literal::DebugString(), DebugString(), impala::SlotRef::GetBigIntVal(), impala::Literal::GetBigIntVal(), impala::ScalarFnCall::GetBigIntVal(), impala::HiveUdfCall::GetBigIntVal(), impala::SlotRef::GetBooleanVal(), impala::Literal::GetBooleanVal(), impala::HiveUdfCall::GetBooleanVal(), impala::ScalarFnCall::GetBooleanVal(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), GetConstVal(), impala::SlotRef::GetDecimalVal(), impala::Literal::GetDecimalVal(), impala::ScalarFnCall::GetDecimalVal(), impala::HiveUdfCall::GetDecimalVal(), impala::SlotRef::GetDoubleVal(), impala::Literal::GetDoubleVal(), impala::ScalarFnCall::GetDoubleVal(), impala::HiveUdfCall::GetDoubleVal(), impala::SlotRef::GetFloatVal(), impala::Literal::GetFloatVal(), impala::ScalarFnCall::GetFloatVal(), impala::HiveUdfCall::GetFloatVal(), impala::SlotRef::GetIntVal(), impala::Literal::GetIntVal(), impala::ScalarFnCall::GetIntVal(), impala::HiveUdfCall::GetIntVal(), impala::SlotRef::GetSmallIntVal(), impala::Literal::GetSmallIntVal(), impala::ScalarFnCall::GetSmallIntVal(), impala::HiveUdfCall::GetSmallIntVal(), impala::SlotRef::GetStringVal(), impala::Literal::GetStringVal(), impala::HiveUdfCall::GetStringVal(), impala::ScalarFnCall::GetStringVal(), impala::SlotRef::GetTimestampVal(), impala::ScalarFnCall::GetTimestampVal(), impala::HiveUdfCall::GetTimestampVal(), impala::SlotRef::GetTinyIntVal(), impala::Literal::GetTinyIntVal(), impala::HiveUdfCall::GetTinyIntVal(), impala::ScalarFnCall::GetTinyIntVal(), impala::ExprContext::GetValue(), impala::Literal::Literal(), impala::ScalarFnCall::Open(), impala::HiveUdfCall::Open(), impala::ScalarFnCall::Prepare(), and Prepare().