Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
conditional-functions.cc
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
16 #include "runtime/runtime-state.h"
17 #include "udf/udf.h"
18 
19 #include "common/names.h"
20 
21 using namespace impala;
22 using namespace impala_udf;
23 
24 #define CONDITIONAL_CODEGEN_FN(expr_class) \
25  Status expr_class::GetCodegendComputeFn(RuntimeState* state, llvm::Function** fn) { \
26  return GetCodegendComputeFnWrapper(state, fn); \
27  }
28 
33 
35  if (val.is_null) return BooleanVal(false);
36  return BooleanVal(!val.val);
37 }
38 
40  if (val.is_null) return BooleanVal(true);
41  return BooleanVal(val.val);
42 }
43 
45  if (val.is_null) return BooleanVal(false);
46  return BooleanVal(val.val);
47 }
48 
50  if (val.is_null) return BooleanVal(true);
51  return BooleanVal(!val.val);
52 }
static BooleanVal IsNotTrue(FunctionContext *ctx, const BooleanVal &val)
static BooleanVal IsTrue(FunctionContext *ctx, const BooleanVal &val)
bool is_null
Definition: udf.h:359
static BooleanVal IsNotFalse(FunctionContext *ctx, const BooleanVal &val)
static BooleanVal IsFalse(FunctionContext *ctx, const BooleanVal &val)
#define CONDITIONAL_CODEGEN_FN(expr_class)