GitHub user hvanhovell opened a pull request:

    https://github.com/apache/spark/pull/12897

    [SPARK-13370][SQL] Require whitespace between expression and alias [WIP]

    ## What changes were proposed in this pull request?
    The parser currently interprets `1.0L` as `Alias(Literal(BigDecimal(1.0)), 
"L")`. This violates the principle of least surprise. This PR changes this 
behavior and forces a user to put whitespace between an expression and its 
alias.
    
    This only downside to this is that we now also disallow the following code: 
`(1+1)a`. Which is IMO should also be allowed.
    
    Another approach could be adding a check in the `AstBuilder` in which we 
check if there is a space between an alias and the expression. I am open to 
suggestions.
    
    ## How was this patch tested?
    Added tests to `ExpressionParserSuite`.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hvanhovell/spark SPARK-13370-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/12897.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12897
    
----
commit 0c8eb06a0a89de7c8f436c03999cf7c1f7a40589
Author: Herman van Hovell <[email protected]>
Date:   2016-05-04T12:42:17Z

    Require white space between expression and alias

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to