drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: Some questions on UDFs
Date Sat, 04 Jul 2015 18:37:50 GMT
If you look at the zip function in
https://github.com/mapr-demos/simple-drill-functions you can have an
example of building a structure.

The basic idea is that your output is denoted as

        @Output
        BaseWriter.ComplexWriter writer;

The pattern for building a list of lists of integers is like this:

        writer.setValueCount(n);
        ...
        BaseWriter.ListWriter outer = writer.rootAsList();
        outer.start(); // [ outer list
        ...
        // for each inner list
            BaseWriter.ListWriter inner = outer.list();
            inner.start();
            // for each inner list element
                inner.integer().writeInt(accessor.get(i));
            }
            inner.end();   // ] inner list
        }
        outer.end(); // ] outer list



On Sat, Jul 4, 2015 at 10:29 AM, Jim Bates <jbates@maprtech.com> wrote:

> I have working aggregation and simple UDFs. I've been trying to document
> and understand each of the options available in a Drill UDF. Understanding
> the different FunctionScope's, the ones that are allowed, the ones that are
> not. The impact of different cost categories. The different  steps needed
> to understand handling any of the supported data types  and structures in
> drill.
>
> Here are a few of my current road blocks. Any pointers would be greatly
> appreciated.
>
>
>    1. I've been trying to understand how to correctly use RepeatedHolders
>    of whatever type. For this discussion lets start with a
>    RepeatedBigIntHolder. I'm trying to figure out the best way to create a
> new
>    one. I have not figured out where in the existing drill code someone
> does
>    this. If I use a  RepeatedBigIntHolder as a Workspace object is is null
> to
>    start with. I created a new one in the startup section of the udf but
> the
>    vector was null. I can find no reference in creating a new BigIntVector.
>    There is a way to create a BigIntVector and I did find an example of
>    creating a new VarCharVector but I can't do that using the drill jar
> files
>    from 1.0. The org.apache.drill.common.types.TypeProtos and
>    the org.apache.drill.common.types.TypeProtos.MinorType classes do not
>    appear to be accessible from the drill jar files.
>    2. What is the best way to close out a UDF in the event it generates an
>    exception? Are there specific steps one should follow to make a clean
> exit
>    in a catch block that are beneficial to Drill?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message