spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] cloud-fan commented on a change in pull request #26595: [SPARK-29956][SQL] A literal number with an exponent should be parsed to Double
Date Tue, 19 Nov 2019 12:06:38 GMT
cloud-fan commented on a change in pull request #26595: [SPARK-29956][SQL] A literal number
with an exponent should be parsed to Double
URL: https://github.com/apache/spark/pull/26595#discussion_r347885447
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -1939,11 +1939,32 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef]
with Logging
     Literal(BigDecimal(ctx.getText).underlying())
   }
 
+  /**
+   * Create a decimal literal for a regular decimal number.
+   */
+  override def visitLegacyDecimalLiteral(ctx: LegacyDecimalLiteralContext)
+    : Literal = withOrigin(ctx) {
+    Literal(BigDecimal(ctx.getText).underlying())
+  }
+
+  /**
+   * Create a double literal for number with an exponent, e.g. 1E-30
+   */
+  override def visitExponentLiteral(ctx: ExponentLiteralContext): Literal = {
+    numericLiteral(ctx, Double.MinValue, Double.MaxValue, DoubleType.simpleString)(_.toDouble)
 
 Review comment:
   What `numericLiteral` does is to strip the suffix, which we don't have in expenent. We
need to fix it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message