private static boolean isCustomUDF(String udfName) { if (udfName == null) { return false; } FunctionInfo funcInfo; try { funcInfo = FunctionRegistry.getFunctionInfo(udfName); } catch (SemanticException e) { LOG.warn("Failed to load " + udfName, e); funcInfo = null; } if (funcInfo == null) { return false; } boolean isNativeFunc = funcInfo.isNative(); return !isNativeFunc; }
private static boolean isCustomUDF(String udfName) { if (udfName == null) { return false; } FunctionInfo funcInfo; try { funcInfo = FunctionRegistry.getFunctionInfo(udfName); } catch (SemanticException e) { LOG.warn("Failed to load " + udfName, e); funcInfo = null; } if (funcInfo == null) { return false; } boolean isNativeFunc = funcInfo.isNative(); return !isNativeFunc; }
private boolean checkAggregator(AggregationDesc agg) throws SemanticException { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Checking '%s'", agg.getExprString())); } boolean result = checkExpressions(agg.getParameters()); FunctionInfo fi = FunctionRegistry.getFunctionInfo(agg.getGenericUDAFName()); result = result && (fi != null) && fi.isNative(); if (!result) { LOG.info("Aggregator is not native: " + agg.getExprString()); } return result; }
private boolean checkAggregator(AggregationDesc agg) throws SemanticException { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Checking '%s'", agg.getExprString())); } boolean result = checkExpressions(agg.getParameters()); FunctionInfo fi = FunctionRegistry.getFunctionInfo(agg.getGenericUDAFName()); result = result && (fi != null) && fi.isNative(); if (!result) { LOG.info("Aggregator is not native: " + agg.getExprString()); } return result; }
if ((!isNative && function.isBuiltIn()) || (isNative && !function.isNative())) { throw new RuntimeException("Function " + functionName + " is not for this registry");
if ((!isNative && function.isBuiltIn()) || (isNative && !function.isNative())) { throw new RuntimeException("Function " + functionName + " is not for this registry");
public void testRegisterTemporaryFunctions() throws Exception { FunctionResource[] emptyResources = new FunctionResource[] {}; // UDF FunctionRegistry.registerTemporaryUDF("tmp_ln", UDFLn.class, emptyResources); FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo("tmp_ln"); assertFalse(functionInfo.isNative()); // GenericUDF FunctionRegistry.registerTemporaryUDF("tmp_concat", GenericUDFConcat.class, emptyResources); functionInfo = FunctionRegistry.getFunctionInfo("tmp_concat"); assertFalse(functionInfo.isNative()); // GenericUDAF FunctionRegistry.registerTemporaryUDF("tmp_max",GenericUDAFMax.class, emptyResources); functionInfo = FunctionRegistry.getFunctionInfo("tmp_max"); assertFalse(functionInfo.isNative()); functionInfo = FunctionRegistry.getWindowFunctionInfo("tmp_max"); assertFalse(functionInfo.isNative()); // UDTF FunctionRegistry.registerTemporaryUDF("tmp_explode", GenericUDTFExplode.class, emptyResources); functionInfo = FunctionRegistry.getFunctionInfo("tmp_explode"); assertFalse(functionInfo.isNative()); }
public void testBuiltInFunction() throws Exception { FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo("ln"); assertTrue(functionInfo.isBuiltIn()); assertTrue(functionInfo.isNative()); }
if (!fi.isNative()) { ctx.getUnparseTranslator().addIdentifierTranslation( (ASTNode) expr.getChild(0));
if (!fi.isNative()) { ctx.getUnparseTranslator().addIdentifierTranslation( (ASTNode) expr.getChild(0));
FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo("perm_ln"); assertTrue(functionInfo.isPersistent()); assertTrue(functionInfo.isNative()); assertFalse(functionInfo.isBuiltIn()); functionInfo = FunctionRegistry.getFunctionInfo("default.perm_ln"); assertTrue(functionInfo.isPersistent()); assertTrue(functionInfo.isNative()); assertFalse(functionInfo.isBuiltIn()); functionInfo = FunctionRegistry.getFunctionInfo("default.perm_concat"); assertTrue(functionInfo.isPersistent()); assertTrue(functionInfo.isNative()); assertFalse(functionInfo.isBuiltIn()); functionInfo = FunctionRegistry.getWindowFunctionInfo("default.perm_max"); assertTrue(functionInfo.isPersistent()); assertTrue(functionInfo.isNative()); assertFalse(functionInfo.isBuiltIn()); functionInfo = FunctionRegistry.getFunctionInfo("default.perm_explode"); assertTrue(functionInfo.isPersistent()); assertTrue(functionInfo.isNative()); assertFalse(functionInfo.isBuiltIn());
genericUDTF = fi.getGenericUDTF(); genericUDTFName = funcName; if (!fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) expr.getChild(0));
globalLimitCtx.setHasTransformOrUDTF(true); if (isUDTF && !fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) udtfExpr .getChild(0));
globalLimitCtx.setHasTransformOrUDTF(true); if (isUDTF && !fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) udtfExpr .getChild(0));
genericUDTF = fi.getGenericUDTF(); genericUDTFName = funcName; if (!fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) expr.getChild(0));
if (!fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) expressionTree .getChild(0));
if (!fi.isNative()) { unparseTranslator.addIdentifierTranslation((ASTNode) expressionTree .getChild(0));
public static void unregisterTemporaryUDF(String functionName) throws HiveException { FunctionInfo fi = mFunctions.get(functionName.toLowerCase()); if (fi != null) { if (!fi.isNative()) { mFunctions.remove(functionName.toLowerCase()); } else { throw new HiveException("Function " + functionName + " is hive native, it can't be dropped"); } } }
public static boolean isCustomUDF(ExprNodeGenericFuncDesc expr) { String udfName = expr.getFuncText(); if (udfName == null) { return false; } FunctionInfo funcInfo; try { funcInfo = FunctionRegistry.getFunctionInfo(udfName); } catch (SemanticException e) { LOG.warn("Failed to load " + udfName, e); funcInfo = null; } if (funcInfo == null) { return false; } boolean isNativeFunc = funcInfo.isNative(); return !isNativeFunc; }
private static FunctionInfo handleCastForParameterizedType(TypeInfo ti, FunctionInfo fi) { SettableUDF udf = (SettableUDF) fi.getGenericUDF(); try { udf.setTypeInfo(ti); } catch (UDFArgumentException e) { throw new RuntimeException(e); } return new FunctionInfo( fi.isNative(), fi.getDisplayName(), (GenericUDF) udf, fi.getResources()); }