It looks to me that this adds only syntactic suger which doesn't provide
much additional value. On the contrary, it might even bring confusion to
non-sql-server users. As you have already noted, it's not ISO standard.
Writing queries this way actually make them less portable. Personally I'd
discourage such an addition.

Thanks,
Xuefu

On Thu, Oct 8, 2015 at 5:48 AM, Furcy Pin <[email protected]> wrote:

> Hi folks,
>
>
> I would like to start a discussion with the Hive user and developper
> community about an element of syntax present in SQL Server that could be
> nice to have in Hive.
>
>
> Back in 2012, before I started Hive, and was using SQL Server, I came
> accross this post :
>
>
> http://sqlblog.com/blogs/aaron_bertrand/archive/2012/01/23/bad-habits-to-kick-using-as-instead-of-for-column-aliases.aspx
>
> that convinced me to write my queries like
>
> #1
> SELECT
>     myColumn = someFunction(someColumn),
>     myOtherColumn = someOtherFunction(someOtherColumn)
> FROM ...
>
> rather than
>
> #2
> SELECT
>     someFunction(someColumn) as myColumn
>     someOtherFunction(someOtherColumn) as myOtherColumn
> FROM ...
>
> The two syntax are equivalent in SQL Server, but only the second is
> allowed in Hive.
>
> In my opinion, there are two advantages of using #1 over #2 (and it seems
> the blog post I mention above only mentions the first) :
>
>    1. Readability: usually the name of the columns you are computing
>    matters more than how you compute them.
>    2. Updates: #1 can easily be transformed into an update query, #2
>    requires some rewriting (thank god I discovered Sublime Text and its
>    multi-line editing)
>
>
> On the other side, #1 is unfortunately not ISO compliant, even though IMHO
> ISO did not pick the best choice this time... Besides Hive it would not be
> Hive's first deviation from ISO.
>
> I would like to hear what do you people think, would it be a good idea to
> implement this in Hive?
>
> Cheers,
>
> Furcy
>
>

Reply via email to