[QUESTION] Scala Table API syntax

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

[QUESTION] Scala Table API syntax

Ufuk Celebi-2
Hey all,

I am not very proficient with Scala and have some questions regarding the
Scala Table API:

The logical queries in the Java API are all String-based, e.g.

table.groupBy("word")

In the Scala API, this works as well, but what's further possible is this:

expr.groupBy('word)

For comparisions you use something like `a === `b. Note that the ' is a
Scala symbol.

- How common is this kind of notation for Scala users?
- Are both types of expressions equivalent or can you do more with the
special Scala syntax Table API?

I am asking, because I was wondering whether we should stick to the
String-based notation in the docs and have the special syntax as an
optional thing. There is no reason for this, if this is common in the Scala
world though. :-)

– Ufuk
Reply | Threaded
Open this post in threaded view
|

Re: [QUESTION] Scala Table API syntax

Stephan Ewen
I am not a deep Scala progammer either, but I think the symbols are a
pretty wide-spread concept.
For example, the Scalding tuple API makes heavy use of them as well.

That said, I do like the idea that the Scala Table API supports the string
variant as well, for homogeneity.

On Sun, Apr 12, 2015 at 1:12 PM, Ufuk Celebi <[hidden email]> wrote:

> Hey all,
>
> I am not very proficient with Scala and have some questions regarding the
> Scala Table API:
>
> The logical queries in the Java API are all String-based, e.g.
>
> table.groupBy("word")
>
> In the Scala API, this works as well, but what's further possible is this:
>
> expr.groupBy('word)
>
> For comparisions you use something like `a === `b. Note that the ' is a
> Scala symbol.
>
> - How common is this kind of notation for Scala users?
> - Are both types of expressions equivalent or can you do more with the
> special Scala syntax Table API?
>
> I am asking, because I was wondering whether we should stick to the
> String-based notation in the docs and have the special syntax as an
> optional thing. There is no reason for this, if this is common in the Scala
> world though. :-)
>
> – Ufuk
>
mxm
Reply | Threaded
Open this post in threaded view
|

Re: [QUESTION] Scala Table API syntax

mxm
'Symbol is actually syntactic sugar for Symbol("Symbol") which is part of
the Scala standard library. It is a core feature of Scala which IMO is
perfectly fine to use. I'm not sure whether it makes the expression much
easier to read but it is a neat feature already in place.

@Stephan: As far as I know, the String-based parsing is already possible in
the Scala Table API.

On Sun, Apr 12, 2015 at 2:51 PM, Stephan Ewen <[hidden email]> wrote:

> I am not a deep Scala progammer either, but I think the symbols are a
> pretty wide-spread concept.
> For example, the Scalding tuple API makes heavy use of them as well.
>
> That said, I do like the idea that the Scala Table API supports the string
> variant as well, for homogeneity.
>
> On Sun, Apr 12, 2015 at 1:12 PM, Ufuk Celebi <[hidden email]> wrote:
>
> > Hey all,
> >
> > I am not very proficient with Scala and have some questions regarding the
> > Scala Table API:
> >
> > The logical queries in the Java API are all String-based, e.g.
> >
> > table.groupBy("word")
> >
> > In the Scala API, this works as well, but what's further possible is
> this:
> >
> > expr.groupBy('word)
> >
> > For comparisions you use something like `a === `b. Note that the ' is a
> > Scala symbol.
> >
> > - How common is this kind of notation for Scala users?
> > - Are both types of expressions equivalent or can you do more with the
> > special Scala syntax Table API?
> >
> > I am asking, because I was wondering whether we should stick to the
> > String-based notation in the docs and have the special syntax as an
> > optional thing. There is no reason for this, if this is common in the
> Scala
> > world though. :-)
> >
> > – Ufuk
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [QUESTION] Scala Table API syntax

Till Rohrmann
IMO the symbol notation makes it slightly easier to write Table API
expressions, because the IDE can assist you in what operations are
supported by the expression DSL whereas the string notation will only give
you a syntax error upon compilation, right?

On Mon, Apr 13, 2015 at 10:42 AM, Maximilian Michels <[hidden email]> wrote:

> 'Symbol is actually syntactic sugar for Symbol("Symbol") which is part of
> the Scala standard library. It is a core feature of Scala which IMO is
> perfectly fine to use. I'm not sure whether it makes the expression much
> easier to read but it is a neat feature already in place.
>
> @Stephan: As far as I know, the String-based parsing is already possible in
> the Scala Table API.
>
> On Sun, Apr 12, 2015 at 2:51 PM, Stephan Ewen <[hidden email]> wrote:
>
> > I am not a deep Scala progammer either, but I think the symbols are a
> > pretty wide-spread concept.
> > For example, the Scalding tuple API makes heavy use of them as well.
> >
> > That said, I do like the idea that the Scala Table API supports the
> string
> > variant as well, for homogeneity.
> >
> > On Sun, Apr 12, 2015 at 1:12 PM, Ufuk Celebi <[hidden email]> wrote:
> >
> > > Hey all,
> > >
> > > I am not very proficient with Scala and have some questions regarding
> the
> > > Scala Table API:
> > >
> > > The logical queries in the Java API are all String-based, e.g.
> > >
> > > table.groupBy("word")
> > >
> > > In the Scala API, this works as well, but what's further possible is
> > this:
> > >
> > > expr.groupBy('word)
> > >
> > > For comparisions you use something like `a === `b. Note that the ' is a
> > > Scala symbol.
> > >
> > > - How common is this kind of notation for Scala users?
> > > - Are both types of expressions equivalent or can you do more with the
> > > special Scala syntax Table API?
> > >
> > > I am asking, because I was wondering whether we should stick to the
> > > String-based notation in the docs and have the special syntax as an
> > > optional thing. There is no reason for this, if this is common in the
> > Scala
> > > world though. :-)
> > >
> > > – Ufuk
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [QUESTION] Scala Table API syntax

Aljoscha Krettek-2
@Till: Correct

On Mon, Apr 13, 2015 at 10:52 AM, Till Rohrmann <[hidden email]> wrote:

> IMO the symbol notation makes it slightly easier to write Table API
> expressions, because the IDE can assist you in what operations are
> supported by the expression DSL whereas the string notation will only give
> you a syntax error upon compilation, right?
>
> On Mon, Apr 13, 2015 at 10:42 AM, Maximilian Michels <[hidden email]> wrote:
>
>> 'Symbol is actually syntactic sugar for Symbol("Symbol") which is part of
>> the Scala standard library. It is a core feature of Scala which IMO is
>> perfectly fine to use. I'm not sure whether it makes the expression much
>> easier to read but it is a neat feature already in place.
>>
>> @Stephan: As far as I know, the String-based parsing is already possible in
>> the Scala Table API.
>>
>> On Sun, Apr 12, 2015 at 2:51 PM, Stephan Ewen <[hidden email]> wrote:
>>
>> > I am not a deep Scala progammer either, but I think the symbols are a
>> > pretty wide-spread concept.
>> > For example, the Scalding tuple API makes heavy use of them as well.
>> >
>> > That said, I do like the idea that the Scala Table API supports the
>> string
>> > variant as well, for homogeneity.
>> >
>> > On Sun, Apr 12, 2015 at 1:12 PM, Ufuk Celebi <[hidden email]> wrote:
>> >
>> > > Hey all,
>> > >
>> > > I am not very proficient with Scala and have some questions regarding
>> the
>> > > Scala Table API:
>> > >
>> > > The logical queries in the Java API are all String-based, e.g.
>> > >
>> > > table.groupBy("word")
>> > >
>> > > In the Scala API, this works as well, but what's further possible is
>> > this:
>> > >
>> > > expr.groupBy('word)
>> > >
>> > > For comparisions you use something like `a === `b. Note that the ' is a
>> > > Scala symbol.
>> > >
>> > > - How common is this kind of notation for Scala users?
>> > > - Are both types of expressions equivalent or can you do more with the
>> > > special Scala syntax Table API?
>> > >
>> > > I am asking, because I was wondering whether we should stick to the
>> > > String-based notation in the docs and have the special syntax as an
>> > > optional thing. There is no reason for this, if this is common in the
>> > Scala
>> > > world though. :-)
>> > >
>> > > – Ufuk
>> > >
>> >
>>
mxm
Reply | Threaded
Open this post in threaded view
|

Re: [QUESTION] Scala Table API syntax

mxm
Hadn't thought about that but it makes perfect sense. Very handy.

On Mon, Apr 13, 2015 at 12:02 PM, Aljoscha Krettek <[hidden email]>
wrote:

> @Till: Correct
>
> On Mon, Apr 13, 2015 at 10:52 AM, Till Rohrmann <[hidden email]>
> wrote:
> > IMO the symbol notation makes it slightly easier to write Table API
> > expressions, because the IDE can assist you in what operations are
> > supported by the expression DSL whereas the string notation will only
> give
> > you a syntax error upon compilation, right?
> >
> > On Mon, Apr 13, 2015 at 10:42 AM, Maximilian Michels <[hidden email]>
> wrote:
> >
> >> 'Symbol is actually syntactic sugar for Symbol("Symbol") which is part
> of
> >> the Scala standard library. It is a core feature of Scala which IMO is
> >> perfectly fine to use. I'm not sure whether it makes the expression much
> >> easier to read but it is a neat feature already in place.
> >>
> >> @Stephan: As far as I know, the String-based parsing is already
> possible in
> >> the Scala Table API.
> >>
> >> On Sun, Apr 12, 2015 at 2:51 PM, Stephan Ewen <[hidden email]> wrote:
> >>
> >> > I am not a deep Scala progammer either, but I think the symbols are a
> >> > pretty wide-spread concept.
> >> > For example, the Scalding tuple API makes heavy use of them as well.
> >> >
> >> > That said, I do like the idea that the Scala Table API supports the
> >> string
> >> > variant as well, for homogeneity.
> >> >
> >> > On Sun, Apr 12, 2015 at 1:12 PM, Ufuk Celebi <[hidden email]> wrote:
> >> >
> >> > > Hey all,
> >> > >
> >> > > I am not very proficient with Scala and have some questions
> regarding
> >> the
> >> > > Scala Table API:
> >> > >
> >> > > The logical queries in the Java API are all String-based, e.g.
> >> > >
> >> > > table.groupBy("word")
> >> > >
> >> > > In the Scala API, this works as well, but what's further possible is
> >> > this:
> >> > >
> >> > > expr.groupBy('word)
> >> > >
> >> > > For comparisions you use something like `a === `b. Note that the '
> is a
> >> > > Scala symbol.
> >> > >
> >> > > - How common is this kind of notation for Scala users?
> >> > > - Are both types of expressions equivalent or can you do more with
> the
> >> > > special Scala syntax Table API?
> >> > >
> >> > > I am asking, because I was wondering whether we should stick to the
> >> > > String-based notation in the docs and have the special syntax as an
> >> > > optional thing. There is no reason for this, if this is common in
> the
> >> > Scala
> >> > > world though. :-)
> >> > >
> >> > > – Ufuk
> >> > >
> >> >
> >>
>