When the function getDisplayString will get called in Hive UDF

Viewed 177

I'm working on Hive UDF using GenericUDF. When I extends GenericUDF class I have to give implementation of three functions.

public Object evaluate(DeferredObject[] obj) throws HiveException {
    //some code
}

public String getDisplayString(String[] arg0) {
    //some code
}

public ObjectInspector initialize(ObjectInspector[] arg0) throws UDFArgumentException {
   //some code
}

My question is, when the function getDisplayString will be called? Or is there any command to call this function. I.e I'm giving some information about the function inside this method so is there any way to call this function?

@Override
public String getDisplayString(String[] arg0) {
    return "This is dlength UDF using hive3";
}

Like, I have created one function to give me length of a string. len()

hive> select len("some string");
OK
11
Time taken: 1.758 seconds, Fetched: 1 row(s)

Can we execute the function getDisplayString so we can get the output on the CLI?

Thanks.

0 Answers
Related