distinct() Java API

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

distinct() Java API

Flavio Pompermaier
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio
Reply | Threaded
Open this post in threaded view
|

Re: distinct() Java API

Maximilian Michels
Hi Flavio,

Do you have an exapmple? The DistinctOperator should return a typed output just like all the other operators do.

Best,
Max

On Fri, Apr 17, 2015 at 10:07 AM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio

Reply | Threaded
Open this post in threaded view
|

Re: distinct() Java API

Flavio Pompermaier
I have errors in Eclipse doing something like:

DataSet<Tuple5<String,String,String,String,String>> ds = ....
DataSet<Tuple1<String>> ds2 = .ds.project(0).distinct(0);

It says that I have to declare ds2 as a Dataset<Tuple>

On Fri, Apr 17, 2015 at 11:15 AM, Maximilian Michels <[hidden email]> wrote:
Hi Flavio,

Do you have an exapmple? The DistinctOperator should return a typed output just like all the other operators do.

Best,
Max

On Fri, Apr 17, 2015 at 10:07 AM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio




Reply | Threaded
Open this post in threaded view
|

Re: distinct() Java API

Fabian Hueske-2
The problem is cause by the project() operator.
The Java compiler does infer its return type and defaults to Tuple.

You can help the compiler like this:

DataSet<Tuple1<String>> ds2 = ds.<Tuple1<String>project(0).distinct(0);


2015-04-17 4:33 GMT-05:00 Flavio Pompermaier <[hidden email]>:
I have errors in Eclipse doing something like:

DataSet<Tuple5<String,String,String,String,String>> ds = ....
DataSet<Tuple1<String>> ds2 = .ds.project(0).distinct(0);

It says that I have to declare ds2 as a Dataset<Tuple>

On Fri, Apr 17, 2015 at 11:15 AM, Maximilian Michels <[hidden email]> wrote:
Hi Flavio,

Do you have an exapmple? The DistinctOperator should return a typed output just like all the other operators do.

Best,
Max

On Fri, Apr 17, 2015 at 10:07 AM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio





Reply | Threaded
Open this post in threaded view
|

Re: distinct() Java API

Flavio Pompermaier
That worked like a charm!

Thanks a lot Fabian!

On Fri, Apr 17, 2015 at 12:37 PM, Fabian Hueske <[hidden email]> wrote:
The problem is cause by the project() operator.
The Java compiler does infer its return type and defaults to Tuple.

You can help the compiler like this:

DataSet<Tuple1<String>> ds2 = ds.<Tuple1<String>project(0).distinct(0);


2015-04-17 4:33 GMT-05:00 Flavio Pompermaier <[hidden email]>:

I have errors in Eclipse doing something like:

DataSet<Tuple5<String,String,String,String,String>> ds = ....
DataSet<Tuple1<String>> ds2 = .ds.project(0).distinct(0);

It says that I have to declare ds2 as a Dataset<Tuple>

On Fri, Apr 17, 2015 at 11:15 AM, Maximilian Michels <[hidden email]> wrote:
Hi Flavio,

Do you have an exapmple? The DistinctOperator should return a typed output just like all the other operators do.

Best,
Max

On Fri, Apr 17, 2015 at 10:07 AM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio





Reply | Threaded
Open this post in threaded view
|

Re: distinct() Java API

Fabian Hueske-2
Cool :-)

We should add this tip to the documentation of the project operator.
I'll open a JIRA for that.

2015-04-17 5:41 GMT-05:00 Flavio Pompermaier <[hidden email]>:
That worked like a charm!

Thanks a lot Fabian!

On Fri, Apr 17, 2015 at 12:37 PM, Fabian Hueske <[hidden email]> wrote:
The problem is cause by the project() operator.
The Java compiler does infer its return type and defaults to Tuple.

You can help the compiler like this:

DataSet<Tuple1<String>> ds2 = ds.<Tuple1<String>project(0).distinct(0);


2015-04-17 4:33 GMT-05:00 Flavio Pompermaier <[hidden email]>:

I have errors in Eclipse doing something like:

DataSet<Tuple5<String,String,String,String,String>> ds = ....
DataSet<Tuple1<String>> ds2 = .ds.project(0).distinct(0);

It says that I have to declare ds2 as a Dataset<Tuple>

On Fri, Apr 17, 2015 at 11:15 AM, Maximilian Michels <[hidden email]> wrote:
Hi Flavio,

Do you have an exapmple? The DistinctOperator should return a typed output just like all the other operators do.

Best,
Max

On Fri, Apr 17, 2015 at 10:07 AM, Flavio Pompermaier <[hidden email]> wrote:
Hi guys,

I'm trying to make (in Java) a project().distinct() but then I cannot create the generated dataset with a typed tuple because the distinct operator returns just an untyped Tuple.
Is this an error in the APIs or am I doing something wrong?

Best,
Flavio