[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread srinathshankar
Github user srinathshankar commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75548962
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,17 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)
--- End diff --

Done


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread srinathshankar
Github user srinathshankar commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75548986
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,17 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)
+(minValue: BigDecimal, maxValue: BigDecimal, 
typeName: String)
--- End diff --

Done


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread hvanhovell
Github user hvanhovell commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75542559
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,17 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)
+(minValue: BigDecimal, maxValue: BigDecimal, 
typeName: String)
--- End diff --

Nit: formatting is a bit weird. Use 4 spaces.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread hvanhovell
Github user hvanhovell commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75538597
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,17 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)
--- End diff --

Three parameter lists? Could you reduce that? 


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread srinathshankar
Github user srinathshankar commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75535335
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1291,28 +1297,32 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   /**
* Create a Byte Literal expression.
*/
-  override def visitTinyIntLiteral(ctx: TinyIntLiteralContext): Literal = 
numericLiteral(ctx) {
+  override def visitTinyIntLiteral(ctx: TinyIntLiteralContext): Literal =
+  numericLiteral(ctx)((Byte.MinValue, Byte.MaxValue), 
ByteType.simpleString) {
--- End diff --

Done.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread srinathshankar
Github user srinathshankar commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75535229
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,16 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)(range: (BigDecimal, 
BigDecimal), typeName: String)
--- End diff --

Done.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75530829
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1291,28 +1297,32 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   /**
* Create a Byte Literal expression.
*/
-  override def visitTinyIntLiteral(ctx: TinyIntLiteralContext): Literal = 
numericLiteral(ctx) {
+  override def visitTinyIntLiteral(ctx: TinyIntLiteralContext): Literal =
+  numericLiteral(ctx)((Byte.MinValue, Byte.MaxValue), 
ByteType.simpleString) {
--- End diff --

need some indentation here, e.g.
```
override def visitTinyIntLiteral(ctx: TinyIntLiteralContext): Literal = {
  numericLiteral(ctx)((Byte.MinValue, Byte.MaxValue), 
ByteType.simpleString)(_.toByte)
}
```


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #14721: [SPARK-17158][SQL] Change error message for out o...

2016-08-19 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/14721#discussion_r75530744
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ---
@@ -1278,10 +1278,16 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] 
with Logging {
   }
 
   /** Create a numeric literal expression. */
-  private def numericLiteral(ctx: NumberContext)(f: String => Any): 
Literal = withOrigin(ctx) {
-val raw = ctx.getText
+  private def numericLiteral(ctx: NumberContext)(range: (BigDecimal, 
BigDecimal), typeName: String)
--- End diff --

a small nit - maybe we should just take minValue, maxValue , typeName? 
rather than putting min value and max value in a tuple.



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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