Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::InPredicate Class Referenceabstract

Predicate for evaluating expressions of the form "val [NOT] IN (x1, x2, x3...)". More...

#include <in-predicate.h>

Inheritance diagram for impala::InPredicate:
Collaboration diagram for impala::InPredicate:

Classes

struct  SetLookupState
 

Public Member Functions

template<typename T , typename SetType , bool not_in, InPredicate::Strategy strategy>
BooleanVal TemplatedIn (FunctionContext *ctx, const T &val, int num_args, const T *args)
 
virtual BooleanVal GetBooleanVal (ExprContext *context, TupleRow *)
 
virtual TinyIntVal GetTinyIntVal (ExprContext *context, TupleRow *)
 
virtual SmallIntVal GetSmallIntVal (ExprContext *context, TupleRow *)
 
virtual IntVal GetIntVal (ExprContext *context, TupleRow *)
 
virtual BigIntVal GetBigIntVal (ExprContext *context, TupleRow *)
 
virtual FloatVal GetFloatVal (ExprContext *context, TupleRow *)
 
virtual DoubleVal GetDoubleVal (ExprContext *context, TupleRow *)
 
virtual StringVal GetStringVal (ExprContext *context, TupleRow *)
 
virtual TimestampVal GetTimestampVal (ExprContext *context, TupleRow *)
 
virtual DecimalVal GetDecimalVal (ExprContext *context, TupleRow *)
 
int output_scale () const
 
void AddChild (Expr *expr)
 
ExprGetChild (int i) const
 
int GetNumChildren () const
 
const ColumnTypetype () const
 
bool is_slotref () const
 
const std::vector< Expr * > & children () const
 
virtual bool IsConstant () const
 
virtual int GetSlotIds (std::vector< SlotId > *slot_ids) const
 
virtual Status GetCodegendComputeFn (RuntimeState *state, llvm::Function **fn)=0
 
virtual AnyValGetConstVal (ExprContext *context)
 
virtual std::string DebugString () const
 

Static Public Member Functions

static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::BooleanVal &val, int num_args, const impala_udf::BooleanVal *args)
 Functions for every type. More...
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::BooleanVal &val, int num_args, const impala_udf::BooleanVal *args)
 
static void SetLookupPrepare_boolean (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_boolean (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::BooleanVal &val, int num_args, const impala_udf::BooleanVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::BooleanVal &val, int num_args, const impala_udf::BooleanVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::TinyIntVal &val, int num_args, const impala_udf::TinyIntVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::TinyIntVal &val, int num_args, const impala_udf::TinyIntVal *args)
 
static void SetLookupPrepare_tinyint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_tinyint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::TinyIntVal &val, int num_args, const impala_udf::TinyIntVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::TinyIntVal &val, int num_args, const impala_udf::TinyIntVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::SmallIntVal &val, int num_args, const impala_udf::SmallIntVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::SmallIntVal &val, int num_args, const impala_udf::SmallIntVal *args)
 
static void SetLookupPrepare_smallint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_smallint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::SmallIntVal &val, int num_args, const impala_udf::SmallIntVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::SmallIntVal &val, int num_args, const impala_udf::SmallIntVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::IntVal &val, int num_args, const impala_udf::IntVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::IntVal &val, int num_args, const impala_udf::IntVal *args)
 
static void SetLookupPrepare_int (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_int (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::IntVal &val, int num_args, const impala_udf::IntVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::IntVal &val, int num_args, const impala_udf::IntVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::BigIntVal &val, int num_args, const impala_udf::BigIntVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::BigIntVal &val, int num_args, const impala_udf::BigIntVal *args)
 
static void SetLookupPrepare_bigint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_bigint (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::BigIntVal &val, int num_args, const impala_udf::BigIntVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::BigIntVal &val, int num_args, const impala_udf::BigIntVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::FloatVal &val, int num_args, const impala_udf::FloatVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::FloatVal &val, int num_args, const impala_udf::FloatVal *args)
 
static void SetLookupPrepare_float (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_float (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::FloatVal &val, int num_args, const impala_udf::FloatVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::FloatVal &val, int num_args, const impala_udf::FloatVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::DoubleVal &val, int num_args, const impala_udf::DoubleVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::DoubleVal &val, int num_args, const impala_udf::DoubleVal *args)
 
static void SetLookupPrepare_double (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_double (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::DoubleVal &val, int num_args, const impala_udf::DoubleVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::DoubleVal &val, int num_args, const impala_udf::DoubleVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::StringVal &val, int num_args, const impala_udf::StringVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::StringVal &val, int num_args, const impala_udf::StringVal *args)
 
static void SetLookupPrepare_string (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_string (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::StringVal &val, int num_args, const impala_udf::StringVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::StringVal &val, int num_args, const impala_udf::StringVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::TimestampVal &val, int num_args, const impala_udf::TimestampVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::TimestampVal &val, int num_args, const impala_udf::TimestampVal *args)
 
static void SetLookupPrepare_timestamp (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_timestamp (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::TimestampVal &val, int num_args, const impala_udf::TimestampVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::TimestampVal &val, int num_args, const impala_udf::TimestampVal *args)
 
static impala_udf::BooleanVal InIterate (impala_udf::FunctionContext *context, const impala_udf::DecimalVal &val, int num_args, const impala_udf::DecimalVal *args)
 
static impala_udf::BooleanVal NotInIterate (impala_udf::FunctionContext *context, const impala_udf::DecimalVal &val, int num_args, const impala_udf::DecimalVal *args)
 
static void SetLookupPrepare_decimal (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static void SetLookupClose_decimal (impala_udf::FunctionContext *ctx, impala_udf::FunctionContext::FunctionStateScope scope)
 
static impala_udf::BooleanVal InSetLookup (impala_udf::FunctionContext *context, const impala_udf::DecimalVal &val, int num_args, const impala_udf::DecimalVal *args)
 
static impala_udf::BooleanVal NotInSetLookup (impala_udf::FunctionContext *context, const impala_udf::DecimalVal &val, int num_args, const impala_udf::DecimalVal *args)
 
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 ExprCreateLiteral (ObjectPool *pool, const ColumnType &type, void *data)
 
static ExprCreateLiteral (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

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...
 
std::string DebugString (const std::string &expr_name) const
 Simple debug string that provides no expr subclass-specific information. More...
 
FunctionContextRegisterFunctionContext (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)
 

Protected Attributes

LibCache::LibCacheEntrycache_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< AnyValconstant_val_
 

Private Types

enum  Strategy { SET_LOOKUP, ITERATE }
 

Static Private Member Functions

template<typename T , typename SetType , bool not_in, Strategy strategy>
static impala_udf::BooleanVal TemplatedIn (impala_udf::FunctionContext *context, const T &val, int num_args, const T *args)
 
template<typename T , typename SetType >
static void SetLookupPrepare (FunctionContext *ctx, FunctionContext::FunctionStateScope scope)
 Initializes an SetLookupState in ctx. More...
 
template<typename SetType >
static void SetLookupClose (FunctionContext *ctx, FunctionContext::FunctionStateScope scope)
 
template<typename T , typename SetType >
static BooleanVal SetLookup (SetLookupState< SetType > *state, const T &v)
 Looks up v in state->val_set. More...
 
template<typename T >
static BooleanVal Iterate (const FunctionContext::TypeDesc *type, const T &val, int num_args, const T *args)
 Iterates through each vararg looking for val. 'type' is the type of 'val' and 'args'. More...
 

Friends

class InPredicateBenchmark
 

Detailed Description

Predicate for evaluating expressions of the form "val [NOT] IN (x1, x2, x3...)".

There are two strategies for evaluating the IN predicate: 1) SET_LOOKUP: This strategy is for when all the values in the IN list are constant. In the prepare function, we create a set of the constant values from the IN list, and use this set to lookup a given 'val'. 2) ITERATE: This is the fallback strategy for when their are non-constant IN list values, or very few values in the IN list. We simply iterate through every expression and compare it to val. This strategy has no prepare function. The FE chooses which strategy we should use by choosing the appropriate function (e.g., InIterate() or InSetLookup()). If it chooses SET_LOOKUP, it also sets the appropriate SetLookupPrepare and SetLookupClose functions. TODO: the set lookup logic is not yet implemented for TimestampVals or DecimalVals

Definition at line 42 of file in-predicate.h.

Member Enumeration Documentation

Enumerator
SET_LOOKUP 

Indicates we should use SetLookUp().

ITERATE 

Indicates we should use Iterate().

Definition at line 268 of file in-predicate.h.

Member Function Documentation

void impala::Expr::AddChild ( Expr expr)
inlineinherited

Definition at line 141 of file expr.h.

Referenced by impala::Expr::CreateTreeFromThrift().

const std::vector<Expr*>& impala::Expr::children ( ) const
inlineinherited
Status Expr::Clone ( const std::vector< ExprContext * > &  ctxs,
RuntimeState state,
std::vector< ExprContext * > *  new_ctxs 
)
staticinherited

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().

void Expr::Close ( RuntimeState state,
ExprContext context,
FunctionContext::FunctionStateScope  scope = FunctionContext::FRAGMENT_LOCAL 
)
protectedvirtualinherited

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 impala::Expr::cache_entry_, impala::Expr::children_, impala::LibCache::DecrementUseCount(), and impala::LibCache::instance().

static int impala::Expr::ComputeResultsLayout ( const std::vector< Expr * > &  exprs,
std::vector< int > *  offsets,
int *  var_result_begin 
)
staticinherited

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 int impala::Expr::ComputeResultsLayout ( const std::vector< ExprContext * > &  ctxs,
std::vector< int > *  offsets,
int *  var_result_begin 
)
staticinherited
Status Expr::CreateExprTree ( ObjectPool pool,
const TExpr &  texpr,
ExprContext **  ctx 
)
staticinherited
Status Expr::CreateExprTrees ( ObjectPool pool,
const std::vector< TExpr > &  texprs,
std::vector< ExprContext * > *  ctxs 
)
staticinherited

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 impala::Expr::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().

Function * Expr::CreateIrFunctionPrototype ( LlvmCodeGen codegen,
const std::string &  name,
llvm::Value *(*)  args[2] 
)
protectedinherited
static Expr* impala::Expr::CreateLiteral ( ObjectPool pool,
const ColumnType type,
void *  data 
)
staticinherited

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 Expr* impala::Expr::CreateLiteral ( ObjectPool pool,
const ColumnType type,
const std::string &   
)
staticinherited

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.

static std::string impala::Expr::DebugString ( const std::vector< Expr * > &  exprs)
staticinherited
static std::string impala::Expr::DebugString ( const std::vector< ExprContext * > &  ctxs)
staticinherited
std::string impala::Expr::DebugString ( const std::string &  expr_name) const
inlineprotectedinherited

Simple debug string that provides no expr subclass-specific information.

Definition at line 332 of file expr.h.

References impala_udf::DebugString().

BooleanVal Expr::GetBooleanVal ( ExprContext context,
TupleRow row 
)
virtualinherited

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 impala::Expr::DebugString().

Referenced by impala::ExprContext::GetBooleanVal(), impala::Expr::GetBooleanVal(), impala::Expr::GetConstVal(), and impala::ExprContext::GetValue().

Expr* impala::Expr::GetChild ( int  i) const
inlineinherited

Definition at line 142 of file expr.h.

Referenced by impala::HiveUdfCall::Evaluate(), and impala::HiveUdfCall::Prepare().

virtual Status impala::Expr::GetCodegendComputeFn ( RuntimeState state,
llvm::Function **  fn 
)
pure virtualinherited

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().

Status Expr::GetCodegendComputeFnWrapper ( RuntimeState state,
llvm::Function **  fn 
)
protectedinherited

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(), impala::Expr::CreateIrFunctionPrototype(), impala::LlvmCodeGen::FinalizeFunction(), impala::RuntimeState::GetCodegen(), impala::LlvmCodeGen::GetPtrType(), impala::Expr::GetStaticGetValWrapper(), impala::Expr::ir_compute_fn_, impala::Expr::LLVM_CLASS_NAME, impala::Status::OK, RETURN_IF_ERROR, and impala::Expr::type().

Referenced by impala::TupleIsNullPredicate::GetCodegendComputeFn(), and impala::HiveUdfCall::GetCodegendComputeFn().

int Expr::GetSlotIds ( std::vector< SlotId > *  slot_ids) const
virtualinherited

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 impala::Expr::children_.

Function * Expr::GetStaticGetValWrapper ( ColumnType  type,
LlvmCodeGen codegen 
)
protectedinherited

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 impala::Expr::GetCodegendComputeFnWrapper().

void Expr::InitBuiltinsDummy ( )
staticinherited
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::BooleanVal val,
int  num_args,
const impala_udf::BooleanVal args 
)
static

Functions for every type.

Referenced by impala::Expr::InitBuiltinsDummy().

static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::TinyIntVal val,
int  num_args,
const impala_udf::TinyIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::SmallIntVal val,
int  num_args,
const impala_udf::SmallIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::IntVal val,
int  num_args,
const impala_udf::IntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::BigIntVal val,
int  num_args,
const impala_udf::BigIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::FloatVal val,
int  num_args,
const impala_udf::FloatVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::DoubleVal val,
int  num_args,
const impala_udf::DoubleVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::StringVal val,
int  num_args,
const impala_udf::StringVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::TimestampVal val,
int  num_args,
const impala_udf::TimestampVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InIterate ( impala_udf::FunctionContext context,
const impala_udf::DecimalVal val,
int  num_args,
const impala_udf::DecimalVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::BooleanVal val,
int  num_args,
const impala_udf::BooleanVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::TinyIntVal val,
int  num_args,
const impala_udf::TinyIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::SmallIntVal val,
int  num_args,
const impala_udf::SmallIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::IntVal val,
int  num_args,
const impala_udf::IntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::BigIntVal val,
int  num_args,
const impala_udf::BigIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::FloatVal val,
int  num_args,
const impala_udf::FloatVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::DoubleVal val,
int  num_args,
const impala_udf::DoubleVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::StringVal val,
int  num_args,
const impala_udf::StringVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::TimestampVal val,
int  num_args,
const impala_udf::TimestampVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::InSetLookup ( impala_udf::FunctionContext context,
const impala_udf::DecimalVal val,
int  num_args,
const impala_udf::DecimalVal args 
)
static
bool impala::Expr::is_slotref ( ) const
inlineinherited

Definition at line 146 of file expr.h.

bool Expr::IsConstant ( ) const
virtualinherited

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 impala::Expr::children_.

Referenced by impala::Expr::GetConstVal(), and impala::ScalarFnCall::IsConstant().

template<typename T >
template BooleanVal impala::InPredicate::Iterate< IntVal > ( const FunctionContext::TypeDesc type,
const T &  val,
int  num_args,
const T *  args 
)
staticprivate

Iterates through each vararg looking for val. 'type' is the type of 'val' and 'args'.

Definition at line 116 of file in-predicate-ir.cc.

References impala_udf::BooleanVal::null().

Referenced by impala::InPredicateBenchmark::TestIterate().

static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::BooleanVal val,
int  num_args,
const impala_udf::BooleanVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::TinyIntVal val,
int  num_args,
const impala_udf::TinyIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::SmallIntVal val,
int  num_args,
const impala_udf::SmallIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::IntVal val,
int  num_args,
const impala_udf::IntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::BigIntVal val,
int  num_args,
const impala_udf::BigIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::FloatVal val,
int  num_args,
const impala_udf::FloatVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::DoubleVal val,
int  num_args,
const impala_udf::DoubleVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::StringVal val,
int  num_args,
const impala_udf::StringVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::TimestampVal val,
int  num_args,
const impala_udf::TimestampVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInIterate ( impala_udf::FunctionContext context,
const impala_udf::DecimalVal val,
int  num_args,
const impala_udf::DecimalVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::BooleanVal val,
int  num_args,
const impala_udf::BooleanVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::TinyIntVal val,
int  num_args,
const impala_udf::TinyIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::SmallIntVal val,
int  num_args,
const impala_udf::SmallIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::IntVal val,
int  num_args,
const impala_udf::IntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::BigIntVal val,
int  num_args,
const impala_udf::BigIntVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::FloatVal val,
int  num_args,
const impala_udf::FloatVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::DoubleVal val,
int  num_args,
const impala_udf::DoubleVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::StringVal val,
int  num_args,
const impala_udf::StringVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::TimestampVal val,
int  num_args,
const impala_udf::TimestampVal args 
)
static
static impala_udf::BooleanVal impala::InPredicate::NotInSetLookup ( impala_udf::FunctionContext context,
const impala_udf::DecimalVal val,
int  num_args,
const impala_udf::DecimalVal args 
)
static
Status Expr::Open ( RuntimeState state,
ExprContext context,
FunctionContext::FunctionStateScope  scope = FunctionContext::FRAGMENT_LOCAL 
)
protectedvirtualinherited

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 impala::Expr::children_, impala::Status::OK, impala::Expr::Open(), and RETURN_IF_ERROR.

int impala::Expr::output_scale ( ) const
inlineinherited

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?

Definition at line 139 of file expr.h.

Status Expr::Prepare ( RuntimeState state,
const RowDescriptor row_desc,
ExprContext context 
)
protectedvirtualinherited

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 impala::Expr::children_, impala::INVALID_TYPE, impala::Status::OK, impala::Expr::Prepare(), RETURN_IF_ERROR, impala::ColumnType::type, and impala::Expr::type_.

FunctionContext * Expr::RegisterFunctionContext ( ExprContext ctx,
RuntimeState state,
int  varargs_buffer_size = 0 
)
protectedinherited

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().

template<typename T , typename SetType >
BooleanVal impala::InPredicate::SetLookup ( SetLookupState< SetType > *  state,
const T &  v 
)
staticprivate
template<typename SetType >
void impala::InPredicate::SetLookupClose ( FunctionContext ctx,
FunctionContext::FunctionStateScope  scope 
)
staticprivate
static void impala::InPredicate::SetLookupClose_bigint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_boolean ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_decimal ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_double ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_float ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_int ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_smallint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_string ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_timestamp ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupClose_tinyint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_bigint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_boolean ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_decimal ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_double ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_float ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_int ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_smallint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_string ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_timestamp ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
static void impala::InPredicate::SetLookupPrepare_tinyint ( impala_udf::FunctionContext ctx,
impala_udf::FunctionContext::FunctionStateScope  scope 
)
static
template<typename T , typename SetType , bool not_in, InPredicate::Strategy strategy>
BooleanVal impala::InPredicate::TemplatedIn ( FunctionContext ctx,
const T &  val,
int  num_args,
const T *  args 
)
template<typename T , typename SetType , bool not_in, Strategy strategy>
static impala_udf::BooleanVal impala::InPredicate::TemplatedIn ( impala_udf::FunctionContext context,
const T &  val,
int  num_args,
const T *  args 
)
inlinestaticprivate

The templated function that provides the implementation for all the In() and NotIn() functions.

Friends And Related Function Documentation

friend class InPredicateBenchmark
friend

Definition at line 266 of file in-predicate.h.

Member Data Documentation

LibCache::LibCacheEntry* impala::Expr::cache_entry_
protectedinherited

Cache entry for the library implementing this function.

Definition at line 281 of file expr.h.

Referenced by impala::Expr::Close(), impala::ScalarFnCall::GetFunction(), impala::ScalarFnCall::GetUdf(), impala::ScalarFnCall::Prepare(), and impala::Expr::~Expr().

boost::scoped_ptr<AnyVal> impala::Expr::constant_val_
protectedinherited

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 impala::Expr::GetConstVal().

llvm::Function* impala::Expr::ir_compute_fn_
protectedinherited
const bool impala::Expr::is_slotref_
protectedinherited

recognize if this node is a slotref in order to speed up GetValue()

Definition at line 287 of file expr.h.

const char * Expr::LLVM_CLASS_NAME = "class.impala::Expr"
staticinherited
int impala::Expr::output_scale_
protectedinherited

Definition at line 291 of file expr.h.

Referenced by impala::ExprContext::GetValue(), and impala::ScalarFnCall::Open().

const ColumnType impala::Expr::type_
protectedinherited

analysis is done, types are fixed at this point

Definition at line 289 of file expr.h.

Referenced by impala::Literal::DebugString(), impala::Expr::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(), impala::Expr::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 impala::Expr::Prepare().


The documentation for this class was generated from the following files: