VarCharHolder, as its name indicates, will contain a VarChar data type.
Assuming you are using a DrillSimpleFunc you will need to have a param
specified as a for a VarCharHolder. Below is a simple class to revive and
return a varchar object. If you post what you are doing we can correct it
for you quickly.
public class MySimpleFunctions {
@FunctionTemplate(name = "ExampleVarCharUDF", isRandom = true,scope =
FunctionScope.SIMPLE, nulls = FunctionTemplate.NullHandling.NULL_IF_NULL)
public class ExampleVarCharUDF implements DrillSimpleFunc {
@Param VarCharHolder in;
@Inject DrillBuf buffer;
@Output VarCharHolder out;
public void setup() {
}
public void eval() {
String inputStr =
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(in.start,
in.end, in.buffer);
String outputStr = inputStr + " I added some stuff to my input";
out.buffer = buffer;
out.start = 0;
out.end = outputStr.toByteArray().length;
out.buffer.setBytes(0, outputStr.toByteArray());
}
}
}
On Sat, Jul 18, 2015 at 8:41 PM, George Lu <[email protected]> wrote:
> Hey all,
>
> I would like to write some custom function for HBase, such as json string
> operation and Time convert, I know the tutorial on the website, but I feel
> it is kinda easy and only covers the skeletons, has anyone has experience
> in writing custom function for HBase, what is the input data type
> (VarCharHolder?).
> Can we add more tutorial?
>
> Thanks!
>
> George Lu
>