Search in sources :

Example 1 with GenericUDFCurrentTimestamp

use of org.apache.hadoop.hive.ql.udf.generic.GenericUDFCurrentTimestamp in project hive by apache.

the class TestFunctionRegistry method testIsPermanentFunction.

public void testIsPermanentFunction() throws Exception {
    // Setup exprNode
    GenericUDF udf = new GenericUDFCurrentTimestamp();
    List<ExprNodeDesc> children = new ArrayList<ExprNodeDesc>();
    ExprNodeGenericFuncDesc fnExpr = new ExprNodeGenericFuncDesc(TypeInfoFactory.timestampTypeInfo, udf, children);
    assertFalse("Function not added as permanent yet", FunctionRegistry.isPermanentFunction(fnExpr));
    // Now register as permanent function
    FunctionResource[] emptyResources = new FunctionResource[] {};
    FunctionRegistry.registerPermanentFunction("default.perm_current_timestamp", GenericUDFCurrentTimestamp.class.getName(), true, emptyResources);
    assertTrue("Function should now be recognized as permanent function", FunctionRegistry.isPermanentFunction(fnExpr));
}
Also used : FunctionResource(org.apache.hadoop.hive.ql.exec.FunctionInfo.FunctionResource) GenericUDF(org.apache.hadoop.hive.ql.udf.generic.GenericUDF) GenericUDFCurrentTimestamp(org.apache.hadoop.hive.ql.udf.generic.GenericUDFCurrentTimestamp) ArrayList(java.util.ArrayList) ExprNodeGenericFuncDesc(org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc) ExprNodeDesc(org.apache.hadoop.hive.ql.plan.ExprNodeDesc)

Aggregations

ArrayList (java.util.ArrayList)1 FunctionResource (org.apache.hadoop.hive.ql.exec.FunctionInfo.FunctionResource)1 ExprNodeDesc (org.apache.hadoop.hive.ql.plan.ExprNodeDesc)1 ExprNodeGenericFuncDesc (org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc)1 GenericUDF (org.apache.hadoop.hive.ql.udf.generic.GenericUDF)1 GenericUDFCurrentTimestamp (org.apache.hadoop.hive.ql.udf.generic.GenericUDFCurrentTimestamp)1