[GitHub] spark pull request #23199: [SPARK-26245][SQL] Add Float literal
Github user wangyum closed the pull request at: https://github.com/apache/spark/pull/23199 --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #23199: [SPARK-26245][SQL] Add Float literal
Github user maropu commented on a diff in the pull request: https://github.com/apache/spark/pull/23199#discussion_r238130900 --- Diff: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 --- @@ -1045,6 +1046,11 @@ DOUBLE_LITERAL | DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}? ; +FLOAT_LITERAL +: DIGIT+ EXPONENT? 'F' +| DECIMAL_DIGITS EXPONENT? 'F' {isValidDecimal()}? --- End diff -- This is implementation-specific; ``` hive> create temporary table t1 as select 1.0F; hive> describe t1; OK f decimal(1,0) hive> create temporary table t2 as select 1.0D; hive> describe t2; OK _c0 double ``` ``` postgres=# create temporary table t1 as select 1.0F; postgres=# \d t1 f | numeric | postgres=# create temporary table t2 as select 1.0D; postgres=# \d t2 d | numeric | ``` ``` mysql> create temporary table t1 as select 1.0F; mysql> describe t1; +---+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-+---+ | F | decimal(2,1) | NO | | 0.0 | NULL | +---+--+--+-+-+---+ mysql> create temporary table t2 as select 1.0D; mysql> describe t2; +---+--+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-+---+ | D | decimal(2,1) | NO | | 0.0 | NULL | +---+--+--+-+-+---+ ``` --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #23199: [SPARK-26245][SQL] Add Float literal
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/23199#discussion_r238110252 --- Diff: sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4 --- @@ -1045,6 +1046,11 @@ DOUBLE_LITERAL | DECIMAL_DIGITS EXPONENT? 'D' {isValidDecimal()}? ; +FLOAT_LITERAL +: DIGIT+ EXPONENT? 'F' +| DECIMAL_DIGITS EXPONENT? 'F' {isValidDecimal()}? --- End diff -- Could you check who supports these Float literals? What are their restrictions? The ANSI SQL standard does not have such a literal. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #23199: [SPARK-26245][SQL] Add Float literal
Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/23199#discussion_r238109668 --- Diff: sql/core/src/test/resources/sql-tests/inputs/literals.sql --- @@ -53,6 +53,10 @@ select .e3; -- very large decimals (overflowing double). select 1E309, -1E309; +-- float +select 0F, 1F, 1.2F, -1F, -1.2F, 3.4028235E30F; +select 3.4028235E39F; --- End diff -- Could you move the test cases to the end of the file? Also clearly specify the positive and negative test cases in the comments? More test cases are needed. --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #23199: [SPARK-26245][SQL] Add Float literal
GitHub user wangyum opened a pull request: https://github.com/apache/spark/pull/23199 [SPARK-26245][SQL] Add Float literal ## What changes were proposed in this pull request? This PR adds parser support for `Float` literals. Hive support this feature: ![image](https://user-images.githubusercontent.com/5399861/49337788-e20cac80-f653-11e8-89c4-0fafa4037a82.png) ## How was this patch tested? unit tests You can merge this pull request into a Git repository by running: $ git pull https://github.com/wangyum/spark SPARK-26245 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/23199.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 #23199 commit 57faa4160365e4ec7ef9847861882b469d4953d6 Author: Yuming Wang Date: 2018-12-02T08:56:56Z Add Float literal --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org