gatorsmile commented on a change in pull request #24877: 
[SPARK-28059][SQL][TEST] Port int4.sql
URL: https://github.com/apache/spark/pull/24877#discussion_r295053351
 
 

 ##########
 File path: sql/core/src/test/resources/sql-tests/inputs/pgSQL/int4.sql
 ##########
 @@ -0,0 +1,179 @@
+--
+-- Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
+--
+--
+-- INT4
+-- 
https://github.com/postgres/postgres/blob/REL_12_BETA1/src/test/regress/sql/int4.sql
+--
+
+CREATE TABLE INT4_TBL(f1 int) USING parquet;
+
+-- [SPARK-28023] Trim the string when cast string type to other types
+INSERT INTO INT4_TBL VALUES (trim('   0  '));
+
+INSERT INTO INT4_TBL VALUES (trim('123456     '));
+
+INSERT INTO INT4_TBL VALUES (trim('    -123456'));
+
+-- [SPARK-27923] Invalid input syntax for integer: "34.5" at PostgreSQL
+-- INSERT INTO INT4_TBL(f1) VALUES ('34.5');
+
+-- largest and smallest values
+INSERT INTO INT4_TBL VALUES ('2147483647');
+
+INSERT INTO INT4_TBL VALUES ('-2147483647');
+
+-- bad input values -- should give errors
+-- INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
+-- INSERT INTO INT4_TBL(f1) VALUES ('asdf');
+-- INSERT INTO INT4_TBL(f1) VALUES ('     ');
+-- INSERT INTO INT4_TBL(f1) VALUES ('   asdf   ');
+-- INSERT INTO INT4_TBL(f1) VALUES ('- 1234');
+-- INSERT INTO INT4_TBL(f1) VALUES ('123       5');
+-- INSERT INTO INT4_TBL(f1) VALUES ('');
+
+select * from INT4_TBL;
 
 Review comment:
   This does not exist in the original PostgreSQL test suite.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to