Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
conditional-functions-ir.cc File Reference
Include dependency graph for conditional-functions-ir.cc:

Go to the source code of this file.

Macros

#define IS_NULL_COMPUTE_FUNCTION(type)
 
#define NULL_IF_COMPUTE_FUNCTION(AnyValType)
 
#define NULL_IF_ZERO_COMPUTE_FUNCTION(type)
 
#define ZERO_IF_NULL_COMPUTE_FUNCTION(type)
 
#define IF_COMPUTE_FUNCTION(type)
 
#define COALESCE_COMPUTE_FUNCTION(type)
 

Functions

 IS_NULL_COMPUTE_FUNCTION (BooleanVal)
 
 IS_NULL_COMPUTE_FUNCTION (TinyIntVal)
 
 IS_NULL_COMPUTE_FUNCTION (SmallIntVal)
 
 IS_NULL_COMPUTE_FUNCTION (IntVal)
 
 IS_NULL_COMPUTE_FUNCTION (BigIntVal)
 
 IS_NULL_COMPUTE_FUNCTION (FloatVal)
 
 IS_NULL_COMPUTE_FUNCTION (DoubleVal)
 
 IS_NULL_COMPUTE_FUNCTION (StringVal)
 
 IS_NULL_COMPUTE_FUNCTION (TimestampVal)
 
 IS_NULL_COMPUTE_FUNCTION (DecimalVal)
 
 NULL_IF_COMPUTE_FUNCTION (BooleanVal)
 
 NULL_IF_COMPUTE_FUNCTION (TinyIntVal)
 
 NULL_IF_COMPUTE_FUNCTION (SmallIntVal)
 
 NULL_IF_COMPUTE_FUNCTION (IntVal)
 
 NULL_IF_COMPUTE_FUNCTION (BigIntVal)
 
 NULL_IF_COMPUTE_FUNCTION (FloatVal)
 
 NULL_IF_COMPUTE_FUNCTION (DoubleVal)
 
 NULL_IF_COMPUTE_FUNCTION (StringVal)
 
 NULL_IF_COMPUTE_FUNCTION (TimestampVal)
 
 NULL_IF_COMPUTE_FUNCTION (DecimalVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (TinyIntVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (SmallIntVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (IntVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (BigIntVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (FloatVal)
 
 NULL_IF_ZERO_COMPUTE_FUNCTION (DoubleVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (TinyIntVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (SmallIntVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (IntVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (BigIntVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (FloatVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (DoubleVal)
 
 ZERO_IF_NULL_COMPUTE_FUNCTION (DecimalVal)
 
 IF_COMPUTE_FUNCTION (BooleanVal)
 
 IF_COMPUTE_FUNCTION (TinyIntVal)
 
 IF_COMPUTE_FUNCTION (SmallIntVal)
 
 IF_COMPUTE_FUNCTION (IntVal)
 
 IF_COMPUTE_FUNCTION (BigIntVal)
 
 IF_COMPUTE_FUNCTION (FloatVal)
 
 IF_COMPUTE_FUNCTION (DoubleVal)
 
 IF_COMPUTE_FUNCTION (StringVal)
 
 IF_COMPUTE_FUNCTION (TimestampVal)
 
 IF_COMPUTE_FUNCTION (DecimalVal)
 
 COALESCE_COMPUTE_FUNCTION (BooleanVal)
 
 COALESCE_COMPUTE_FUNCTION (TinyIntVal)
 
 COALESCE_COMPUTE_FUNCTION (SmallIntVal)
 
 COALESCE_COMPUTE_FUNCTION (IntVal)
 
 COALESCE_COMPUTE_FUNCTION (BigIntVal)
 
 COALESCE_COMPUTE_FUNCTION (FloatVal)
 
 COALESCE_COMPUTE_FUNCTION (DoubleVal)
 
 COALESCE_COMPUTE_FUNCTION (StringVal)
 
 COALESCE_COMPUTE_FUNCTION (TimestampVal)
 
 COALESCE_COMPUTE_FUNCTION (DecimalVal)
 

Macro Definition Documentation

#define COALESCE_COMPUTE_FUNCTION (   type)
Value:
type CoalesceExpr::Get##type(ExprContext* context, TupleRow* row) { \
DCHECK_GE(children_.size(), 1); \
for (int i = 0; i < children_.size(); ++i) { \
type val = children_[i]->Get##type(context, row); \
if (!val.is_null) return val; \
} \
return type::null(); \
}

Definition at line 134 of file conditional-functions-ir.cc.

#define IF_COMPUTE_FUNCTION (   type)
Value:
type IfExpr::Get##type(ExprContext* context, TupleRow* row) { \
DCHECK_EQ(children_.size(), 3); \
BooleanVal cond = children_[0]->GetBooleanVal(context, row); \
if (cond.is_null || !cond.val) { \
return children_[2]->Get##type(context, row); \
} \
return children_[1]->Get##type(context, row); \
}

Definition at line 113 of file conditional-functions-ir.cc.

#define IS_NULL_COMPUTE_FUNCTION (   type)
Value:
type IsNullExpr::Get##type(ExprContext* context, TupleRow* row) { \
DCHECK_EQ(children_.size(), 2); \
type val = children_[0]->Get##type(context, row); \
if (!val.is_null) return val; /* short-circuit */ \
return children_[1]->Get##type(context, row); \
}

Definition at line 22 of file conditional-functions-ir.cc.

#define NULL_IF_COMPUTE_FUNCTION (   AnyValType)
Value:
AnyValType NullIfExpr::Get##AnyValType(ExprContext* ctx, TupleRow* row) { \
DCHECK_EQ(children_.size(), 2); \
AnyValType lhs_val = children_[0]->Get##AnyValType(ctx, row); \
/* Short-circuit in case lhs_val is NULL. Can never be equal to RHS. */ \
if (lhs_val.is_null) return AnyValType::null(); \
/* Get rhs and return NULL if lhs == rhs, lhs otherwise */ \
AnyValType rhs_val = children_[1]->Get##AnyValType(ctx, row); \
if (!rhs_val.is_null && AnyValUtil::Equals(children_[0]->type(), lhs_val, rhs_val)) {\
return AnyValType::null(); \
} \
return lhs_val; \
}

Definition at line 41 of file conditional-functions-ir.cc.

#define NULL_IF_ZERO_COMPUTE_FUNCTION (   type)
Value:
type ConditionalFunctions::NullIfZero(FunctionContext* context, const type& val) { \
if (val.is_null || val.val == 0) return type::null(); \
return val; \
}

Definition at line 66 of file conditional-functions-ir.cc.

#define ZERO_IF_NULL_COMPUTE_FUNCTION (   type)
Value:
type ConditionalFunctions::ZeroIfNull(FunctionContext* context, const type& val) { \
if (val.is_null) return type(0); \
return val; \
}

Definition at line 99 of file conditional-functions-ir.cc.

Function Documentation

COALESCE_COMPUTE_FUNCTION ( BooleanVal  )
COALESCE_COMPUTE_FUNCTION ( TinyIntVal  )
COALESCE_COMPUTE_FUNCTION ( SmallIntVal  )
COALESCE_COMPUTE_FUNCTION ( IntVal  )
COALESCE_COMPUTE_FUNCTION ( BigIntVal  )
COALESCE_COMPUTE_FUNCTION ( FloatVal  )
COALESCE_COMPUTE_FUNCTION ( DoubleVal  )
COALESCE_COMPUTE_FUNCTION ( StringVal  )
COALESCE_COMPUTE_FUNCTION ( TimestampVal  )
COALESCE_COMPUTE_FUNCTION ( DecimalVal  )
IF_COMPUTE_FUNCTION ( BooleanVal  )
IF_COMPUTE_FUNCTION ( TinyIntVal  )
IF_COMPUTE_FUNCTION ( SmallIntVal  )
IF_COMPUTE_FUNCTION ( IntVal  )
IF_COMPUTE_FUNCTION ( BigIntVal  )
IF_COMPUTE_FUNCTION ( FloatVal  )
IF_COMPUTE_FUNCTION ( DoubleVal  )
IF_COMPUTE_FUNCTION ( StringVal  )
IF_COMPUTE_FUNCTION ( TimestampVal  )
IF_COMPUTE_FUNCTION ( DecimalVal  )
IS_NULL_COMPUTE_FUNCTION ( BooleanVal  )
IS_NULL_COMPUTE_FUNCTION ( TinyIntVal  )
IS_NULL_COMPUTE_FUNCTION ( SmallIntVal  )
IS_NULL_COMPUTE_FUNCTION ( IntVal  )
IS_NULL_COMPUTE_FUNCTION ( BigIntVal  )
IS_NULL_COMPUTE_FUNCTION ( FloatVal  )
IS_NULL_COMPUTE_FUNCTION ( DoubleVal  )
IS_NULL_COMPUTE_FUNCTION ( StringVal  )
IS_NULL_COMPUTE_FUNCTION ( TimestampVal  )
IS_NULL_COMPUTE_FUNCTION ( DecimalVal  )
NULL_IF_COMPUTE_FUNCTION ( BooleanVal  )
NULL_IF_COMPUTE_FUNCTION ( TinyIntVal  )
NULL_IF_COMPUTE_FUNCTION ( SmallIntVal  )
NULL_IF_COMPUTE_FUNCTION ( IntVal  )
NULL_IF_COMPUTE_FUNCTION ( BigIntVal  )
NULL_IF_COMPUTE_FUNCTION ( FloatVal  )
NULL_IF_COMPUTE_FUNCTION ( DoubleVal  )
NULL_IF_COMPUTE_FUNCTION ( StringVal  )
NULL_IF_COMPUTE_FUNCTION ( TimestampVal  )
NULL_IF_COMPUTE_FUNCTION ( DecimalVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( TinyIntVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( SmallIntVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( IntVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( BigIntVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( FloatVal  )
NULL_IF_ZERO_COMPUTE_FUNCTION ( DoubleVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( TinyIntVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( SmallIntVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( IntVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( BigIntVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( FloatVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( DoubleVal  )
ZERO_IF_NULL_COMPUTE_FUNCTION ( DecimalVal  )