15 package com.cloudera.impala.analysis;
25 import com.cloudera.impala.common.Reference;
26 import com.cloudera.impala.thrift.TExprNode;
27 import com.cloudera.impala.thrift.TExprNodeType;
28 import com.google.common.base.Objects;
29 import com.google.common.base.Preconditions;
30 import com.google.common.collect.Lists;
35 private static final String
IS_NULL =
"is_null_pred";
41 Preconditions.checkNotNull(e);
57 if (t.isNull())
continue;
60 isNullSymbol =
"_ZN6impala15IsNullPredicate6IsNullIN10impala_udf10BooleanValE" +
61 "EES3_PNS2_15FunctionContextERKT_";
63 String udfType = Function.getUdfType(t);
64 isNullSymbol =
"_ZN6impala15IsNullPredicate6IsNullIN10impala_udf" +
65 udfType.length() + udfType +
66 "EEENS2_10BooleanValEPNS2_15FunctionContextERKT_";
68 db.addBuiltin(ScalarFunction.createBuiltinOperator(
71 String isNotNullSymbol = isNullSymbol.replace(
"6IsNull",
"9IsNotNull");
72 db.addBuiltin(ScalarFunction.createBuiltinOperator(
79 if (!super.equals(obj))
return false;
85 return getChild(0).toSql() + (
isNotNull_ ?
" IS NOT NULL" :
" IS NULL");
90 return Objects.toStringHelper(
this)
92 .addValue(super.debugString())
99 super.analyze(analyzer);
106 getChild(0).analyze(analyzer);
119 if (getChild(0).
getType().isNull()) {
135 Reference<SlotRef> slotRefRef =
new Reference<SlotRef>();
138 if (!slotDesc.
getStats().hasNulls())
return;
139 Table table = slotDesc.getParent().getTable();
140 if (table != null && table.
getNumRows() > 0) {
141 long numRows = table.getNumRows();
144 (double) (numRows - slotDesc.
getStats().getNumNulls()) / (double) numRows;
155 msg.node_type = TExprNodeType.FUNCTION_CALL;
164 return getChild(0).unwrapSlotRef(
true);
void uncheckedCastChild(Type targetType, int childIndex)
IsNullPredicate(IsNullPredicate other)
void analyze(Analyzer analyzer)
static final ScalarType BOOLEAN
Type[] collectChildReturnTypes()
static void initBuiltins(Db db)
static final String IS_NOT_NULL
IsNullPredicate(Expr e, boolean isNotNull)
static final String IS_NULL
Function getBuiltinFunction(Analyzer analyzer, String name, Type[] argTypes, CompareMode mode)
boolean isSingleColumnPredicate(Reference< SlotRef > slotRefRef, Reference< Integer > idxRef)
static final com.google.common.base.Predicate< Expr > IS_SCALAR_SUBQUERY
boolean equals(Object obj)
static ArrayList< ScalarType > getSupportedTypes()
void toThrift(TExprNode msg)
static double DEFAULT_SELECTIVITY