Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HIVE-2249 When creating constant expression for numbers, try to infer…
… type from another comparison operand, instead of trying to use integer first, and then long and double (Zhiqiu Kong via Siying Dong) git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1238175 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Siying Dong
committed
Jan 31, 2012
1 parent
19ad00a
commit 2a3978a
Showing
146 changed files
with
1,233 additions
and
707 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1273276712345-12345906-307.01234 | ||
1263276712345-12345906-307.01234 | ||
1263276712345-12345906-307.01.57 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
DROP TABLE infertypes; | ||
CREATE TABLE infertypes(ti TINYINT, si SMALLINT, i INT, bi BIGINT, fl FLOAT, db DOUBLE, str STRING); | ||
|
||
LOAD DATA LOCAL INPATH '../data/files/infer_const_type.txt' OVERWRITE INTO TABLE infertypes; | ||
|
||
SELECT * FROM infertypes; | ||
|
||
EXPLAIN SELECT * FROM infertypes WHERE | ||
ti = '127' AND | ||
si = 32767 AND | ||
i = '12345' AND | ||
bi = '-12345' AND | ||
fl = '0906' AND | ||
db = '-307' AND | ||
str = 1234; | ||
|
||
SELECT * FROM infertypes WHERE | ||
ti = '127' AND | ||
si = 32767 AND | ||
i = '12345' AND | ||
bi = '-12345' AND | ||
fl = '0906' AND | ||
db = '-307' AND | ||
str = 1234; | ||
|
||
-- all should return false as all numbers exceeed the largest number | ||
-- which could be represented by the corresponding type | ||
-- and string_col = long_const should return false | ||
EXPLAIN SELECT * FROM infertypes WHERE | ||
ti = '128' OR | ||
si = 32768 OR | ||
i = '2147483648' OR | ||
bi = '9223372036854775808' OR | ||
fl = 'float' OR | ||
db = 'double'; | ||
|
||
SELECT * FROM infertypes WHERE | ||
ti = '128' OR | ||
si = 32768 OR | ||
i = '2147483648' OR | ||
bi = '9223372036854775808' OR | ||
fl = 'float' OR | ||
db = 'double'; | ||
|
||
-- for the query like: int_col = double, should return false | ||
EXPLAIN SELECT * FROM infertypes WHERE | ||
ti = '127.0' OR | ||
si = 327.0 OR | ||
i = '-100.0'; | ||
|
||
SELECT * FROM infertypes WHERE | ||
ti = '127.0' OR | ||
si = 327.0 OR | ||
i = '-100.0'; | ||
|
||
EXPLAIN SELECT * FROM infertypes WHERE | ||
ti < '127.0' AND | ||
i > '100.0' AND | ||
str = 1.57; | ||
|
||
SELECT * FROM infertypes WHERE | ||
ti < '127.0' AND | ||
i > '100.0' AND | ||
str = 1.57; | ||
|
||
DROP TABLE infertypes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.