use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFMacro in project hive by apache.
the class ExprNodeGenericFuncDesc method isSame.
@Override
public boolean isSame(Object o) {
if (!(o instanceof ExprNodeGenericFuncDesc)) {
return false;
}
ExprNodeGenericFuncDesc dest = (ExprNodeGenericFuncDesc) o;
if (!typeInfo.equals(dest.getTypeInfo()) || !genericUDF.getClass().equals(dest.getGenericUDF().getClass())) {
return false;
}
if (genericUDF instanceof GenericUDFBridge) {
GenericUDFBridge bridge = (GenericUDFBridge) genericUDF;
GenericUDFBridge bridge2 = (GenericUDFBridge) dest.getGenericUDF();
if (!bridge.getUdfClassName().equals(bridge2.getUdfClassName()) || !bridge.getUdfName().equals(bridge2.getUdfName()) || bridge.isOperator() != bridge2.isOperator()) {
return false;
}
}
if (genericUDF instanceof GenericUDFMacro) {
// if getMacroName is null, we always treat it different from others.
if (((GenericUDFMacro) genericUDF).getMacroName() == null || !(((GenericUDFMacro) genericUDF).getMacroName().equals(((GenericUDFMacro) dest.genericUDF).getMacroName()))) {
return false;
}
}
if (chidren.size() != dest.getChildren().size()) {
return false;
}
for (int pos = 0; pos < chidren.size(); pos++) {
if (!chidren.get(pos).isSame(dest.getChildren().get(pos))) {
return false;
}
}
return true;
}
use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFMacro in project hive by apache.
the class Registry method registerMacro.
public FunctionInfo registerMacro(String macroName, ExprNodeDesc body, List<String> colNames, List<TypeInfo> colTypes, FunctionResource... resources) {
GenericUDFMacro macro = new GenericUDFMacro(macroName, body, colNames, colTypes);
FunctionInfo fI = new FunctionInfo(FunctionType.TEMPORARY, macroName, macro, resources);
addFunction(macroName, fI);
return fI;
}
Aggregations