drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Burgess <mattyb...@gmail.com>
Subject Varargs in DrillSimpleFunc
Date Fri, 12 Sep 2014 13:31:21 GMT
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