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: Varargs in DrillSimpleFunc
Date Fri, 12 Sep 2014 15:14:18 GMT
Last I heard, varargs isn't supported yet.

Returning more than one value by putting them in a complex value is
supported now (see the convert to json function) but returning more than
one record is not yet there.  It is a major goal, just not there yet.

So with split should be quite possible to return an array (or really a map
with an array inside). Currently, there isn't a nice way to flatten an
array or filter it, but you can index into the array.

All of this is changing quickly and should get better quickly.






On Fri, Sep 12, 2014 at 6:31 AM, Matt Burgess <mattyb149@gmail.com> wrote:

> Hello all,
>
> How would I implement a Drill function that takes a constant first
> argument, then any number of arguments that would correspond to column
> names? I looked at the code for the "concat" function:
>
>
> https://github.com/apache/incubator-drill/blob/master/exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java#L790
>
> But I can't figure out how it applies the eval() method to an arbitrary
> number of parameters.
>
> Also, is there (or will there be) support for functions that return more
> than one value? I'm picturing something like a map() or transform()
> function (or CROSS APPLY in MSSQL) that can apply a function or something
> to arbitrary number of columns/params and return the transformed set. I see
> on the wiki page that there is support for an Array type:
>
> https://cwiki.apache.org/confluence/display/DRILL/Data+Types
>
> But I don't know how I'd leverage that in a DrillFunc. Here's an example
> query:
>
> SELECT transform("concatTab", *) from dfs.`my_file.csv`
>
> the intent here is that a result set is returned that basically changes a
> CSV file to a TSV result set.
>
> Another example is a split() string function:
>
> SELECT split(" ", fullname)
>
> which might do something like returning a result set with col0 for first
> name and col1 for last name.
>
> I am new to Drill (but excited to get started!) so please forgive any
> ignorance on my part, I look forward to your reply :)
>
> Regards,
> Matt
>

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