You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mrunit.apache.org by Jim Donofrio <do...@gmail.com> on 2012/06/06 04:37:31 UTC
Fwd: MRUNIT-114: should support calling configure on sorting and
grouping comparators if applicable
Jacob,
Did you get the below email?
-------- Original Message --------
Subject: MRUNIT-114: should support calling configure on sorting and
grouping comparators if applicable
Date: Tue, 29 May 2012 22:46:27 -0400
From: Jim Donofrio <do...@gmail.com>
To: user@mrunit.apache.org
Yes that is a bug, nice catch, I created MRUNIT-114.
How are you testing your multiple inputs code, using the LocalJobRunner?
I just MRUnit could test multiple inputs by using the inputformat to
read the data from each of the paths into a mapdriver and then
consolidating the output into one list to pass to one reduce driver.
However, I get nervous that MRUnit will eventually be reimplementing the
LocalJobRunner. Ideally MRUnit would only use the LocalJobRunner by
taking only a JobConf as input and would just provide support code to
make it easier to use by creating the input files and reading the output
files.
We fail to use ReflectionUtils.newInstance on the 2 comparators, it
would be better if most of these classes only took classes as input
instead of the actual object
public void setKeyGroupingComparator(
final RawComparator<K2> groupingComparator) {
keyGroupComparator =
ReflectionUtils.newInstance(returnNonNull(groupingComparator).getClass(), getConfiguration());
}
public void setKeyOrderComparator(final RawComparator<K2>
orderComparator) {
keyValueOrderComparator =
ReflectionUtils.newInstance(returnNonNull(orderComparator),
getConfiguration());
}
https://issues.apache.org/jira/browse/MRUNIT-114
On 05/28/2012 01:40 PM, Jacob Metcalf wrote:
> Yes either would work.
>
> On another subject (maybe I need a new thread/JIRA for this) is it
> intentional that the configuration is not applied to the sorting and
> grouping comparators?
>
> I am writing my own multiple input MR driver to test a reduce side
> join and had to do:
>
> // Configure grouping and sorting comparators
> if (keyGroupComparator instanceof Configured ) {
> ((Configured)keyGroupComparator).setConf( configuration );
> }
> if (keyValueOrderComparator instanceof Configured) {
> ((Configured)keyValueOrderComparator).setConf( configuration );
> }
>
> To get the config applied even though they are Configured objects.
>
> Jacob
>
RE: MRUNIT-114: should support calling configure on sorting and
grouping comparators if applicable
Posted by Jacob Metcalf <ja...@hotmail.com>.
Jim
Yes I did, thanks for putting it in JIRA.
For testing a reduce side join I quickly wrote the attached to simulate MultipleInputs a clone of the MapReduceDriver. However extending it beyond two would call for a different approach possibly using your new InputFormats code. I would also like to be able to perform MultipleOutputs.
One of the things I like about MRUnit is that you can perform traditional unit testing without reliance on a Hadoop install. Apart from making builds faster and more reliable it also means I can develop on Windows without getting Hadoop running under Cygwin. However I can see you have to draw a line as it would be a never ending task replicating all the functionality, especially with all the differences in the two sets of APIs.
Let me know if there is anything else you want me to test.
Jacob
> Date: Tue, 5 Jun 2012 22:37:31 -0400
> From: donofrio111@gmail.com
> To: user@mrunit.apache.org
> Subject: Fwd: MRUNIT-114: should support calling configure on sorting and grouping comparators if applicable
>
> Jacob,
>
> Did you get the below email?
>
> -------- Original Message --------
> Subject: MRUNIT-114: should support calling configure on sorting and
> grouping comparators if applicable
> Date: Tue, 29 May 2012 22:46:27 -0400
> From: Jim Donofrio <do...@gmail.com>
> To: user@mrunit.apache.org
>
> Yes that is a bug, nice catch, I created MRUNIT-114.
>
> How are you testing your multiple inputs code, using the LocalJobRunner?
> I just MRUnit could test multiple inputs by using the inputformat to
> read the data from each of the paths into a mapdriver and then
> consolidating the output into one list to pass to one reduce driver.
> However, I get nervous that MRUnit will eventually be reimplementing the
> LocalJobRunner. Ideally MRUnit would only use the LocalJobRunner by
> taking only a JobConf as input and would just provide support code to
> make it easier to use by creating the input files and reading the output
> files.
>
>
> We fail to use ReflectionUtils.newInstance on the 2 comparators, it
> would be better if most of these classes only took classes as input
> instead of the actual object
>
> public void setKeyGroupingComparator(
> final RawComparator<K2> groupingComparator) {
> keyGroupComparator =
> ReflectionUtils.newInstance(returnNonNull(groupingComparator).getClass(), getConfiguration());
>
>
> }
>
> public void setKeyOrderComparator(final RawComparator<K2>
> orderComparator) {
> keyValueOrderComparator =
> ReflectionUtils.newInstance(returnNonNull(orderComparator),
> getConfiguration());
> }
>
> https://issues.apache.org/jira/browse/MRUNIT-114
>
> On 05/28/2012 01:40 PM, Jacob Metcalf wrote:
> > Yes either would work.
> >
> > On another subject (maybe I need a new thread/JIRA for this) is it
> > intentional that the configuration is not applied to the sorting and
> > grouping comparators?
> >
> > I am writing my own multiple input MR driver to test a reduce side
> > join and had to do:
> >
> > // Configure grouping and sorting comparators
> > if (keyGroupComparator instanceof Configured ) {
> > ((Configured)keyGroupComparator).setConf( configuration );
> > }
> > if (keyValueOrderComparator instanceof Configured) {
> > ((Configured)keyValueOrderComparator).setConf( configuration );
> > }
> >
> > To get the config applied even though they are Configured objects.
> >
> > Jacob
> >