You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Jim Scott <js...@maprtech.com> on 2015/07/21 02:17:04 UTC

Testing a UDF

Are there any unit tests which I can copy from in the drill project that
will allow me to test my UDF that I am creating without the need to do a
full build, package and deploy to test it?

I ask since there is code being generated to package it, and this is kind
of SUPER important :-)

Thanks!
Jim

-- 
*Jim Scott*
Director, Enterprise Strategy & Architecture
+1 (347) 746-9281

 <http://www.mapr.com/>
[image: MapR Technologies] <http://www.mapr.com>

Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Testing a UDF

Posted by Ted Dunning <te...@gmail.com>.
Typo there ...

On Tue, Jul 21, 2015 at 9:49 PM, Jacques Nadeau <ja...@dremio.com> wrote:
>
> It should already work.  Try including the following in your pom:
>
>     <dependency>
>       <groupId>org.apache.drill</groupId>
>       <artifactId>drill-common</artifactId>
>       <classifier>tests</classifier>
>       <version>1.1.0</version>
>       <scope>test</scope>
>     </dependency>
>     <dependency>
>       <groupId>org.apache.drill.exec</groupId>
>       <artifactId>drill-java-exec</artifactId>
>       <version>1.1.0</version>
>       <classifier>tests</classifier>
>       <scope>test</scope>
>     <dependency>

     ^^^^^^^^^ should be </dependency>, of course.

Here is a cleaner version that makes IntelliJ happy:

<dependency>
    <groupId>org.apache.drill.exec</groupId>
    <artifactId>drill-java-exec</artifactId>
    <version>1.1.0</version>
</dependency>
<dependency>
    <groupId>org.apache.drill.exec</groupId>
    <artifactId>drill-java-exec</artifactId>
    <version>1.1.0</version>
    <classifier>tests</classifier>
    <scope>test</scope>
</dependency>

Re: Testing a UDF

Posted by Jacques Nadeau <ja...@dremio.com>.
It should already work.  Try including the following in your pom:

    <dependency>
      <groupId>org.apache.drill</groupId>
      <artifactId>drill-common</artifactId>
      <classifier>tests</classifier>
      <version>1.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.drill.exec</groupId>
      <artifactId>drill-java-exec</artifactId>
      <version>1.1.0</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    <dependency>


On Tue, Jul 21, 2015 at 7:05 PM, Jim Scott <js...@maprtech.com> wrote:

> Ideally, since we want people actively participating / contributing UDFs,
> etc... It might even be beneficial to break out the framework portions of
> the test harnesses so that they can be depended with a scope of test in
> maven by separate projects.
>
> That would make it dead simple for people to whip up UDFs.
>
>
> On Tue, Jul 21, 2015 at 12:25 PM, Ted Dunning <te...@gmail.com>
> wrote:
>
> > Another approach for low-level functional testing is to break the real
> work
> > out into a helper class that allows conventional testing.
> >
> >
> >
> > On Tue, Jul 21, 2015 at 8:20 AM, Jacques Nadeau <ja...@dremio.com>
> > wrote:
> >
> > > I suggest you include the java-exec tests artifact.  You can then
> create
> > a
> > > simple test by extending BaseTestQuery [1] and calling newTest().  That
> > has
> > > decent javadocs to get you started.  To see an example usage, take a
> look
> > > at TestExampleQueries [2] from the Drill codebase.
> > >
> > > [1]
> > >
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/BaseTestQuery.java
> > > [2]
> > >
> > >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
> > >
> > > On Mon, Jul 20, 2015 at 8:41 PM, Ted Dunning <te...@gmail.com>
> > > wrote:
> > >
> > > >
> > > > Last I heard, Jason and others were working in that exact area.
> > > >
> > > > For now, printf still rules.  The good news is that it only takes a
> few
> > > > seconds to rebuild and redeploy to a local instance.  It takes longer
> > to
> > > > stop an start sqlline.
> > > >
> > > > Sent from my iPhone
> > > >
> > > > > On Jul 20, 2015, at 17:17, Jim Scott <js...@maprtech.com> wrote:
> > > > >
> > > > > Are there any unit tests which I can copy from in the drill project
> > > that
> > > > > will allow me to test my UDF that I am creating without the need to
> > do
> > > a
> > > > > full build, package and deploy to test it?
> > > > >
> > > > > I ask since there is code being generated to package it, and this
> is
> > > kind
> > > > > of SUPER important :-)
> > > > >
> > > > > Thanks!
> > > > > Jim
> > > > >
> > > > > --
> > > > > *Jim Scott*
> > > > > Director, Enterprise Strategy & Architecture
> > > > > +1 (347) 746-9281
> > > > >
> > > > > <http://www.mapr.com/>
> > > > > [image: MapR Technologies] <http://www.mapr.com>
> > > > >
> > > > > Now Available - Free Hadoop On-Demand Training
> > > > > <
> > > >
> > >
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > > > >
> > > >
> > >
> >
>
>
>
> --
> *Jim Scott*
> Director, Enterprise Strategy & Architecture
> +1 (347) 746-9281
>
>  <http://www.mapr.com/>
> [image: MapR Technologies] <http://www.mapr.com>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>

Re: Testing a UDF

Posted by Jim Scott <js...@maprtech.com>.
Ideally, since we want people actively participating / contributing UDFs,
etc... It might even be beneficial to break out the framework portions of
the test harnesses so that they can be depended with a scope of test in
maven by separate projects.

That would make it dead simple for people to whip up UDFs.


On Tue, Jul 21, 2015 at 12:25 PM, Ted Dunning <te...@gmail.com> wrote:

> Another approach for low-level functional testing is to break the real work
> out into a helper class that allows conventional testing.
>
>
>
> On Tue, Jul 21, 2015 at 8:20 AM, Jacques Nadeau <ja...@dremio.com>
> wrote:
>
> > I suggest you include the java-exec tests artifact.  You can then create
> a
> > simple test by extending BaseTestQuery [1] and calling newTest().  That
> has
> > decent javadocs to get you started.  To see an example usage, take a look
> > at TestExampleQueries [2] from the Drill codebase.
> >
> > [1]
> >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/BaseTestQuery.java
> > [2]
> >
> >
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
> >
> > On Mon, Jul 20, 2015 at 8:41 PM, Ted Dunning <te...@gmail.com>
> > wrote:
> >
> > >
> > > Last I heard, Jason and others were working in that exact area.
> > >
> > > For now, printf still rules.  The good news is that it only takes a few
> > > seconds to rebuild and redeploy to a local instance.  It takes longer
> to
> > > stop an start sqlline.
> > >
> > > Sent from my iPhone
> > >
> > > > On Jul 20, 2015, at 17:17, Jim Scott <js...@maprtech.com> wrote:
> > > >
> > > > Are there any unit tests which I can copy from in the drill project
> > that
> > > > will allow me to test my UDF that I am creating without the need to
> do
> > a
> > > > full build, package and deploy to test it?
> > > >
> > > > I ask since there is code being generated to package it, and this is
> > kind
> > > > of SUPER important :-)
> > > >
> > > > Thanks!
> > > > Jim
> > > >
> > > > --
> > > > *Jim Scott*
> > > > Director, Enterprise Strategy & Architecture
> > > > +1 (347) 746-9281
> > > >
> > > > <http://www.mapr.com/>
> > > > [image: MapR Technologies] <http://www.mapr.com>
> > > >
> > > > Now Available - Free Hadoop On-Demand Training
> > > > <
> > >
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > > >
> > >
> >
>



-- 
*Jim Scott*
Director, Enterprise Strategy & Architecture
+1 (347) 746-9281

 <http://www.mapr.com/>
[image: MapR Technologies] <http://www.mapr.com>

Now Available - Free Hadoop On-Demand Training
<http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>

Re: Testing a UDF

Posted by Ted Dunning <te...@gmail.com>.
Another approach for low-level functional testing is to break the real work
out into a helper class that allows conventional testing.



On Tue, Jul 21, 2015 at 8:20 AM, Jacques Nadeau <ja...@dremio.com> wrote:

> I suggest you include the java-exec tests artifact.  You can then create a
> simple test by extending BaseTestQuery [1] and calling newTest().  That has
> decent javadocs to get you started.  To see an example usage, take a look
> at TestExampleQueries [2] from the Drill codebase.
>
> [1]
>
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/BaseTestQuery.java
> [2]
>
> https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java
>
> On Mon, Jul 20, 2015 at 8:41 PM, Ted Dunning <te...@gmail.com>
> wrote:
>
> >
> > Last I heard, Jason and others were working in that exact area.
> >
> > For now, printf still rules.  The good news is that it only takes a few
> > seconds to rebuild and redeploy to a local instance.  It takes longer to
> > stop an start sqlline.
> >
> > Sent from my iPhone
> >
> > > On Jul 20, 2015, at 17:17, Jim Scott <js...@maprtech.com> wrote:
> > >
> > > Are there any unit tests which I can copy from in the drill project
> that
> > > will allow me to test my UDF that I am creating without the need to do
> a
> > > full build, package and deploy to test it?
> > >
> > > I ask since there is code being generated to package it, and this is
> kind
> > > of SUPER important :-)
> > >
> > > Thanks!
> > > Jim
> > >
> > > --
> > > *Jim Scott*
> > > Director, Enterprise Strategy & Architecture
> > > +1 (347) 746-9281
> > >
> > > <http://www.mapr.com/>
> > > [image: MapR Technologies] <http://www.mapr.com>
> > >
> > > Now Available - Free Hadoop On-Demand Training
> > > <
> >
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> > >
> >
>

Re: Testing a UDF

Posted by Jacques Nadeau <ja...@dremio.com>.
I suggest you include the java-exec tests artifact.  You can then create a
simple test by extending BaseTestQuery [1] and calling newTest().  That has
decent javadocs to get you started.  To see an example usage, take a look
at TestExampleQueries [2] from the Drill codebase.

[1]
https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/BaseTestQuery.java
[2]
https://github.com/apache/drill/blob/master/exec/java-exec/src/test/java/org/apache/drill/TestExampleQueries.java

On Mon, Jul 20, 2015 at 8:41 PM, Ted Dunning <te...@gmail.com> wrote:

>
> Last I heard, Jason and others were working in that exact area.
>
> For now, printf still rules.  The good news is that it only takes a few
> seconds to rebuild and redeploy to a local instance.  It takes longer to
> stop an start sqlline.
>
> Sent from my iPhone
>
> > On Jul 20, 2015, at 17:17, Jim Scott <js...@maprtech.com> wrote:
> >
> > Are there any unit tests which I can copy from in the drill project that
> > will allow me to test my UDF that I am creating without the need to do a
> > full build, package and deploy to test it?
> >
> > I ask since there is code being generated to package it, and this is kind
> > of SUPER important :-)
> >
> > Thanks!
> > Jim
> >
> > --
> > *Jim Scott*
> > Director, Enterprise Strategy & Architecture
> > +1 (347) 746-9281
> >
> > <http://www.mapr.com/>
> > [image: MapR Technologies] <http://www.mapr.com>
> >
> > Now Available - Free Hadoop On-Demand Training
> > <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>

Re: Testing a UDF

Posted by Ted Dunning <te...@gmail.com>.
Last I heard, Jason and others were working in that exact area.  

For now, printf still rules.  The good news is that it only takes a few seconds to rebuild and redeploy to a local instance.  It takes longer to stop an start sqlline. 

Sent from my iPhone

> On Jul 20, 2015, at 17:17, Jim Scott <js...@maprtech.com> wrote:
> 
> Are there any unit tests which I can copy from in the drill project that
> will allow me to test my UDF that I am creating without the need to do a
> full build, package and deploy to test it?
> 
> I ask since there is code being generated to package it, and this is kind
> of SUPER important :-)
> 
> Thanks!
> Jim
> 
> -- 
> *Jim Scott*
> Director, Enterprise Strategy & Architecture
> +1 (347) 746-9281
> 
> <http://www.mapr.com/>
> [image: MapR Technologies] <http://www.mapr.com>
> 
> Now Available - Free Hadoop On-Demand Training
> <http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available>