Can you try the following

@Param

FieldReader in;

int type = in.getType().getMinorType().getNumber();

*if (*type == org.apache.drill.common.types.TypeProtos.MinorType.
VARCHAR_VALUE) {

    String res = in.readText().toString();
}

and see if it resolves your issue?


On Mon, Sep 26, 2016 at 9:55 AM, Sandeep Dugar <[email protected]> wrote:

> Hi ,
>
> I am trying to write a UDF for which the input is text, possibly with 1K
> characters.
>
> I am trying to get the string value from NullableVarcharHolder via the
> function 
> org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(input.start,
> input.end, input.buffer);
>
> This is resulting in error msg as below:
>
> Error: SYSTEM ERROR: IndexOutOfBoundsException: index: 0, length: 257
> (expected: range(0, 256))
>
> Fragment 1:0
>
>
> Questions:
>
> 1. What should be data type for large input string? Is
> NullableVarcharHolder correct approach?
> 2. How to get it into string in such scenarios?
>
>
> -
> Thanks,
> Sandeep

Reply via email to