[SPARK-26245][SQL] Add Float literal#23199
[SPARK-26245][SQL] Add Float literal#23199wangyum wants to merge 1 commit intoapache:masterfrom wangyum:SPARK-26245
Conversation
|
Test build #99568 has finished for PR 23199 at commit
|
|
retest this please |
|
Test build #99570 has finished for PR 23199 at commit
|
|
retest this please |
|
Test build #99574 has finished for PR 23199 at commit
|
|
retest this please |
|
|
||
| -- float | ||
| select 0F, 1F, 1.2F, -1F, -1.2F, 3.4028235E30F; | ||
| select 3.4028235E39F; |
There was a problem hiding this comment.
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.
|
|
||
| FLOAT_LITERAL | ||
| : DIGIT+ EXPONENT? 'F' | ||
| | DECIMAL_DIGITS EXPONENT? 'F' {isValidDecimal()}? |
There was a problem hiding this comment.
Could you check who supports these Float literals? What are their restrictions?
The ANSI SQL standard does not have such a literal.
There was a problem hiding this comment.
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 |
+-------+--------------+------+-----+---------+-------+
|
Test build #99578 has finished for PR 23199 at commit
|
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Hi, @wangyum .
In Hive 2.3, 1.0D is considered as Double, but 1.0F is considered as 1.0 F where F is an alias.
In Hive 1.2, 1.0D and 1.0F are considered as 1.0 D and 1.0 F where D and F are aliases.
So, this is not for Hive compatibility. We had better close this PR.
What changes were proposed in this pull request?
This PR adds parser support for
Floatliterals.Hive support this feature:

How was this patch tested?
unit tests