Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/12897#discussion_r62128679
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
    @@ -800,7 +800,18 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
       override def visitNamedExpression(ctx: NamedExpressionContext): 
Expression = withOrigin(ctx) {
         val e = expression(ctx.expression)
         if (ctx.identifier != null) {
    -      Alias(e, ctx.identifier.getText)()
    +      val alias = ctx.identifier.getText
    +
    +      // Make sure the expression and its alias are clearly demarcated. An 
clear demarcation is
    +      // either a ' ', ')', ']' or a '>' character.
    +      val adjacent = ctx.expression.stop.getStopIndex + 1 == 
ctx.identifier.start.getStartIndex
    +      val stopChar = ctx.expression.stop.getText.last
    +      assert(!adjacent || stopChar == ')' || stopChar == ']' || stopChar 
== '>',
    +        s"Ambiguous alias '$alias' encountered; " +
    +          s"Please add a space between the expression and the alias",
    +        ctx.identifier)
    +
    +      Alias(e, alias)()
    --- End diff --
    
    Can you help me understand how we resolve the problem that `1.0L` gets 
turned to `decimal(1.0) as L`?


---
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