} else {
try {
// might be a column from another table
Table t = this.metaData.getTableForAlias(tabAlias);
if (t.isPartitionKey(colName)) {
desc = new exprNodeConstantDesc(String.class, null);
}
else {
TypeInfo typeInfo = TypeInfoUtils.getTypeInfoFromObjectInspector(
this.metaData.getTableForAlias(tabAlias).getDeserializer().getObjectInspector());
desc = new exprNodeConstantDesc(typeInfo.getStructFieldTypeInfo(colName), null);
containsPartCols = false;
}
} catch (SerDeException e){
throw new RuntimeException(e);
}
}
break;
}
default: {
boolean isFunction = (expr.getType() == HiveParser.TOK_FUNCTION);
// Create all children
int childrenBegin = (isFunction ? 1 : 0);
ArrayList<exprNodeDesc> children = new ArrayList<exprNodeDesc>(expr.getChildCount() - childrenBegin);
for (int ci=childrenBegin; ci<expr.getChildCount(); ci++) {
exprNodeDesc child = genExprNodeDesc((ASTNode)expr.getChild(ci));
assert(child.getTypeInfo() != null);
children.add(child);
}
// Create function desc
desc = TypeCheckProcFactory.DefaultExprProcessor.getXpathOrFuncExprNodeDesc(expr, isFunction, children);
if (desc instanceof exprNodeFuncDesc && (
((exprNodeFuncDesc)desc).getUDFMethod().getDeclaringClass().equals(UDFOPAnd.class)
|| ((exprNodeFuncDesc)desc).getUDFMethod().getDeclaringClass().equals(UDFOPOr.class)
|| ((exprNodeFuncDesc)desc).getUDFMethod().getDeclaringClass().equals(UDFOPNot.class))) {
// do nothing because "And" and "Or" and "Not" supports null value evaluation
// NOTE: In the future all UDFs that treats null value as UNKNOWN (both in parameters and return
// values) should derive from a common base class UDFNullAsUnknown, so instead of listing the classes
// here we would test whether a class is derived from that base class.
} else if ((desc instanceof exprNodeFuncDesc &&
((exprNodeFuncDesc)desc).getUDFClass().getAnnotation(UDFType.class) != null &&
((exprNodeFuncDesc)desc).getUDFClass().getAnnotation(UDFType.class).deterministic() == false) ||
mightBeUnknown(desc)) {
// If its a non-deterministic UDF or if any child is null, set this node to null
LOG.trace("Pruner function might be unknown: " + expr.toStringTree());
desc = new exprNodeConstantDesc(desc.getTypeInfo(), null);
}
break;
}
}
return desc;