This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 2e0efb467a1 Add floating point data type cases for
PostgreSQL/openGauss (#22418)
2e0efb467a1 is described below
commit 2e0efb467a116db8f73dc97159d47662238eb22e
Author: 吴伟杰 <[email protected]>
AuthorDate: Sat Nov 26 18:31:57 2022 +0800
Add floating point data type cases for PostgreSQL/openGauss (#22418)
* Add floating point data type cases for PostgreSQL/openGauss
* Add TODO for failed cases
---
.../test/integration/cases/value/SQLValue.java | 2 ++
.../passthrough/insert_max_floating_point_values.xml} | 12 +++++-------
.../passthrough/insert_min_floating_point_values.xml} | 12 +++++-------
.../insert_negative_infinity_floating_point_values.xml} | 12 +++++-------
.../insert_positive_infinity_floating_point_values.xml} | 12 +++++-------
.../test/resources/cases/dml/dml-integration-test-cases.xml | 10 ++++++++++
.../env/scenario/passthrough/data/actual/dataset.xml | 5 +++++
.../data/actual/init-sql/mysql/01-actual-init.sql | 1 +
.../data/actual/init-sql/opengauss/01-actual-init.sql | 1 +
.../data/actual/init-sql/postgresql/01-actual-init.sql | 1 +
.../env/scenario/passthrough/data/expected/dataset.xml | 5 +++++
.../data/expected/init-sql/mysql/01-expected-init.sql | 1 +
.../data/expected/init-sql/opengauss/01-expected-init.sql | 1 +
.../data/expected/init-sql/postgresql/01-expected-init.sql | 1 +
14 files changed, 48 insertions(+), 28 deletions(-)
diff --git
a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/value/SQLValue.java
b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/value/SQLValue.java
index b5d62df95c1..5b3789a48dd 100644
---
a/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/value/SQLValue.java
+++
b/test/integration-test/test-suite/src/test/java/org/apache/shardingsphere/test/integration/cases/value/SQLValue.java
@@ -62,6 +62,8 @@ public final class SQLValue {
return Integer.parseInt(value);
case "long":
return Long.parseLong(value);
+ case "float":
+ return Float.parseFloat(value);
case "double":
return Double.parseDouble(value);
case "numeric":
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_max_floating_point_values.xml
similarity index 72%
copy from
test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
copy to
test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_max_floating_point_values.xml
index 92b264c1a87..71dae94b0e1 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_max_floating_point_values.xml
@@ -15,13 +15,11 @@
~ limitations under the License.
-->
-<dataset>
- <metadata data-nodes="passthrough.t_data_type_integer">
+<dataset update-count="1">
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
<column name="id" type="numeric" />
- <column name="col_bigint" type="numeric" />
- <column name="col_int" type="numeric" />
- <column name="col_mediumint" type="numeric" />
- <column name="col_smallint" type="numeric" />
- <column name="col_tinyint" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
</metadata>
+ <row data-node="passthrough.t_data_type_floating_point" values="3,
3.4028235E38, 1.7976931348623157E308" />
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_min_floating_point_values.xml
similarity index 72%
copy from
test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
copy to
test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_min_floating_point_values.xml
index 92b264c1a87..aae7cd060ae 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_min_floating_point_values.xml
@@ -15,13 +15,11 @@
~ limitations under the License.
-->
-<dataset>
- <metadata data-nodes="passthrough.t_data_type_integer">
+<dataset update-count="1">
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
<column name="id" type="numeric" />
- <column name="col_bigint" type="numeric" />
- <column name="col_int" type="numeric" />
- <column name="col_mediumint" type="numeric" />
- <column name="col_smallint" type="numeric" />
- <column name="col_tinyint" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
</metadata>
+ <row data-node="passthrough.t_data_type_floating_point" values="4,
1.4E-45, 4.9E-324" />
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_negative_infinity_floating_point_values.xml
similarity index 72%
copy from
test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
copy to
test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_negative_infinity_floating_point_values.xml
index 92b264c1a87..a8dbcddf9f9 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_negative_infinity_floating_point_values.xml
@@ -15,13 +15,11 @@
~ limitations under the License.
-->
-<dataset>
- <metadata data-nodes="passthrough.t_data_type_integer">
+<dataset update-count="1">
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
<column name="id" type="numeric" />
- <column name="col_bigint" type="numeric" />
- <column name="col_int" type="numeric" />
- <column name="col_mediumint" type="numeric" />
- <column name="col_smallint" type="numeric" />
- <column name="col_tinyint" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
</metadata>
+ <row data-node="passthrough.t_data_type_floating_point" values="2,
-Infinity, -Infinity" />
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_positive_infinity_floating_point_values.xml
similarity index 72%
copy from
test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
copy to
test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_positive_infinity_floating_point_values.xml
index 92b264c1a87..b25458bb352 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/cases/dml/dataset/passthrough/insert_positive_infinity_floating_point_values.xml
@@ -15,13 +15,11 @@
~ limitations under the License.
-->
-<dataset>
- <metadata data-nodes="passthrough.t_data_type_integer">
+<dataset update-count="1">
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
<column name="id" type="numeric" />
- <column name="col_bigint" type="numeric" />
- <column name="col_int" type="numeric" />
- <column name="col_mediumint" type="numeric" />
- <column name="col_smallint" type="numeric" />
- <column name="col_tinyint" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
</metadata>
+ <row data-node="passthrough.t_data_type_floating_point" values="1,
Infinity, Infinity" />
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
b/test/integration-test/test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
index ff293ddc3cd..6bd3d6e9147 100644
---
a/test/integration-test/test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
+++
b/test/integration-test/test-suite/src/test/resources/cases/dml/dml-integration-test-cases.xml
@@ -302,4 +302,14 @@
<assertion parameters="2:int, -9223372036854775808:long,
-2147483648:int, -8388608:int, -32768:smallint, -128:tinyint"
expected-data-file="insert_min_values_into_single_table_integer.xml" />
<assertion parameters="3:int, -1:long, -1:int, -1:int, -1:smallint,
-1:tinyint"
expected-data-file="insert_negative_values_into_single_table_integer.xml" />
</test-case>
+
+ <!-- TODO Fixme https://github.com/apache/shardingsphere/issues/22407
-->
+ <!-- <test-case sql="INSERT INTO t_data_type_floating_point (id,
col_float, col_double) VALUES (?, ?::REAL, ?::DOUBLE PRECISION)"
db-types="PostgreSQL,openGauss" scenario-types="passthrough">-->
+ <!-- <assertion parameters="1:int, Infinity:String,
Infinity:String"
expected-data-file="insert_positive_infinity_floating_point_values.xml"/>-->
+ <!-- <assertion parameters="2:int, -Infinity:String,
-Infinity:String"
expected-data-file="insert_negative_infinity_floating_point_values.xml"/>-->
+ <!-- </test-case>-->
+ <test-case sql="INSERT INTO t_data_type_floating_point (id, col_float,
col_double) VALUES (?, ?, ?)" db-types="PostgreSQL,openGauss"
scenario-types="passthrough">
+ <assertion parameters="3:int, 3.4028235E38:float,
1.7976931348623157E308:double"
expected-data-file="insert_max_floating_point_values.xml" />
+ <assertion parameters="4:int, 1.4E-45:float, 4.9E-324:double"
expected-data-file="insert_min_floating_point_values.xml" />
+ </test-case>
</integration-test-cases>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
index 92b264c1a87..b3437a47e41 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/dataset.xml
@@ -24,4 +24,9 @@
<column name="col_smallint" type="numeric" />
<column name="col_tinyint" type="numeric" />
</metadata>
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
+ <column name="id" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
+ </metadata>
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/mysql/01-actual-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/mysql/01-actual-init.sql
index 9fe5ba19289..e0d764eaa0d 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/mysql/01-actual-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/mysql/01-actual-init.sql
@@ -22,3 +22,4 @@ DROP DATABASE IF EXISTS passthrough;
CREATE DATABASE passthrough;
CREATE TABLE passthrough.t_data_type_integer (id INT PRIMARY KEY, col_bigint
BIGINT NOT NULL, col_int INT NOT NULL, col_mediumint MEDIUMINT NOT NULL,
col_smallint SMALLINT NOT NULL, col_tinyint TINYINT NOT NULL);
+CREATE TABLE passthrough.t_data_type_floating_point (id INT PRIMARY KEY,
col_float REAL NOT NULL, col_double DOUBLE PRECISION NOT NULL);
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/opengauss/01-actual-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/opengauss/01-actual-init.sql
index c5eaf210003..102dc1a3bfb 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/opengauss/01-actual-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/opengauss/01-actual-init.sql
@@ -23,3 +23,4 @@ GRANT ALL PRIVILEGES ON DATABASE passthrough TO test_user;
DROP TABLE IF EXISTS t_data_type_integer;
CREATE TABLE t_data_type_integer (id INT PRIMARY KEY, col_bigint BIGINT NOT
NULL, col_int INT NOT NULL, col_mediumint INT4 NOT NULL, col_smallint SMALLINT
NOT NULL, col_tinyint INT2 NOT NULL);
+CREATE TABLE t_data_type_floating_point (id INT PRIMARY KEY, col_float REAL
NOT NULL, col_double DOUBLE PRECISION NOT NULL);
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/postgresql/01-actual-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/postgresql/01-actual-init.sql
index c5eaf210003..102dc1a3bfb 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/postgresql/01-actual-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -23,3 +23,4 @@ GRANT ALL PRIVILEGES ON DATABASE passthrough TO test_user;
DROP TABLE IF EXISTS t_data_type_integer;
CREATE TABLE t_data_type_integer (id INT PRIMARY KEY, col_bigint BIGINT NOT
NULL, col_int INT NOT NULL, col_mediumint INT4 NOT NULL, col_smallint SMALLINT
NOT NULL, col_tinyint INT2 NOT NULL);
+CREATE TABLE t_data_type_floating_point (id INT PRIMARY KEY, col_float REAL
NOT NULL, col_double DOUBLE PRECISION NOT NULL);
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/dataset.xml
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/dataset.xml
index 87d4ca5eb00..9c01f90ee85 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/dataset.xml
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/dataset.xml
@@ -24,4 +24,9 @@
<column name="col_smallint" type="numeric" />
<column name="col_tinyint" type="numeric" />
</metadata>
+ <metadata data-nodes="passthrough.t_data_type_floating_point">
+ <column name="id" type="numeric" />
+ <column name="col_float" type="numeric" />
+ <column name="col_double" type="numeric" />
+ </metadata>
</dataset>
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/mysql/01-expected-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/mysql/01-expected-init.sql
index bcadcb255e9..0225046eb30 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/mysql/01-expected-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/mysql/01-expected-init.sql
@@ -22,3 +22,4 @@ DROP DATABASE IF EXISTS expected_dataset;
CREATE DATABASE expected_dataset;
CREATE TABLE expected_dataset.t_data_type_integer (id INT PRIMARY KEY,
col_bigint BIGINT NOT NULL, col_int INT NOT NULL, col_mediumint MEDIUMINT NOT
NULL, col_smallint SMALLINT NOT NULL, col_tinyint TINYINT NOT NULL);
+CREATE TABLE expected_dataset.t_data_type_floating_point (id INT PRIMARY KEY,
col_float REAL NOT NULL, col_double DOUBLE PRECISION NOT NULL);
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/opengauss/01-expected-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/opengauss/01-expected-init.sql
index 5429517de9d..57aefdfc7e5 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/opengauss/01-expected-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/opengauss/01-expected-init.sql
@@ -24,3 +24,4 @@ GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO
test_user;
DROP TABLE IF EXISTS t_data_type_integer;
CREATE TABLE t_data_type_integer (id INT PRIMARY KEY, col_bigint BIGINT NOT
NULL, col_int INT NOT NULL, col_mediumint INT4 NOT NULL, col_smallint SMALLINT
NOT NULL, col_tinyint INT2 NOT NULL);
+CREATE TABLE t_data_type_floating_point (id INT PRIMARY KEY, col_float REAL
NOT NULL, col_double DOUBLE PRECISION NOT NULL);
diff --git
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/postgresql/01-expected-init.sql
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/postgresql/01-expected-init.sql
index 7240393b823..9699ff41d83 100644
---
a/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/postgresql/01-expected-init.sql
+++
b/test/integration-test/test-suite/src/test/resources/env/scenario/passthrough/data/expected/init-sql/postgresql/01-expected-init.sql
@@ -24,3 +24,4 @@ GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO
test_user;
DROP TABLE IF EXISTS t_data_type_integer;
CREATE TABLE t_data_type_integer (id INT PRIMARY KEY, col_bigint BIGINT NOT
NULL, col_int INT NOT NULL, col_mediumint INT4 NOT NULL, col_smallint SMALLINT
NOT NULL, col_tinyint INT2 NOT NULL);
+CREATE TABLE t_data_type_floating_point (id INT PRIMARY KEY, col_float REAL
NOT NULL, col_double DOUBLE PRECISION NOT NULL);