You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2023/01/17 03:10:59 UTC
[GitHub] [shardingsphere] TeslaCN opened a new issue, #23597: ShardingSphere-Proxy PostgreSQL Error: Bad value for type BigDecimal : Infinity
TeslaCN opened a new issue, #23597:
URL: https://github.com/apache/shardingsphere/issues/23597
## Bug Report
### Which version of ShardingSphere did you use?
master - 6b095c835f5334f01bb6643565ddb3276e9f9a56
This may impact previous version.
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy PostgreSQL
### Expected behavior
```
postgres=# WITH v(x) AS
(VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan'))
SELECT x1, x2,
x1 + x2 AS sum,
x1 - x2 AS diff,
x1 * x2 AS prod
FROM v AS v1(x1), v AS v2(x2);
x1 | x2 | sum | diff | prod
-----------+-----------+-----------+-----------+-----------
0 | 0 | 0 | 0 | 0
0 | 1 | 1 | -1 | 0
0 | -1 | -1 | 1 | 0
0 | 4.2 | 4.2 | -4.2 | 0.0
0 | Infinity | Infinity | -Infinity | NaN
0 | -Infinity | -Infinity | Infinity | NaN
0 | NaN | NaN | NaN | NaN
1 | 0 | 1 | 1 | 0
1 | 1 | 2 | 0 | 1
1 | -1 | 0 | 2 | -1
1 | 4.2 | 5.2 | -3.2 | 4.2
1 | Infinity | Infinity | -Infinity | Infinity
1 | -Infinity | -Infinity | Infinity | -Infinity
1 | NaN | NaN | NaN | NaN
-1 | 0 | -1 | -1 | 0
-1 | 1 | 0 | -2 | -1
-1 | -1 | -2 | 0 | 1
-1 | 4.2 | 3.2 | -5.2 | -4.2
-1 | Infinity | Infinity | -Infinity | -Infinity
-1 | -Infinity | -Infinity | Infinity | Infinity
-1 | NaN | NaN | NaN | NaN
4.2 | 0 | 4.2 | 4.2 | 0.0
4.2 | 1 | 5.2 | 3.2 | 4.2
4.2 | -1 | 3.2 | 5.2 | -4.2
4.2 | 4.2 | 8.4 | 0.0 | 17.64
4.2 | Infinity | Infinity | -Infinity | Infinity
4.2 | -Infinity | -Infinity | Infinity | -Infinity
4.2 | NaN | NaN | NaN | NaN
Infinity | 0 | Infinity | Infinity | NaN
Infinity | 1 | Infinity | Infinity | Infinity
Infinity | -1 | Infinity | Infinity | -Infinity
Infinity | 4.2 | Infinity | Infinity | Infinity
Infinity | Infinity | Infinity | NaN | Infinity
Infinity | -Infinity | NaN | Infinity | -Infinity
Infinity | NaN | NaN | NaN | NaN
-Infinity | 0 | -Infinity | -Infinity | NaN
-Infinity | 1 | -Infinity | -Infinity | -Infinity
-Infinity | -1 | -Infinity | -Infinity | Infinity
-Infinity | 4.2 | -Infinity | -Infinity | -Infinity
-Infinity | Infinity | NaN | -Infinity | -Infinity
-Infinity | -Infinity | -Infinity | NaN | Infinity
-Infinity | NaN | NaN | NaN | NaN
NaN | 0 | NaN | NaN | NaN
NaN | 1 | NaN | NaN | NaN
NaN | -1 | NaN | NaN | NaN
NaN | 4.2 | NaN | NaN | NaN
NaN | Infinity | NaN | NaN | NaN
NaN | -Infinity | NaN | NaN | NaN
NaN | NaN | NaN | NaN | NaN
(49 rows)
```

### Actual behavior
```
postgres=> WITH v(x) AS
(VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan'))
SELECT x1, x2,
x1 + x2 AS sum,
x1 - x2 AS diff,
x1 * x2 AS prod
FROM v AS v1(x1), v AS v2(x2);
ERROR: Bad value for type BigDecimal : Infinity
```

```
[INFO ] 2023-01-17 11:02:17.531 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: WITH v(x) AS
(VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan'))
SELECT x1, x2,
x1 + x2 AS sum,
x1 - x2 AS diff,
x1 * x2 AS prod
FROM v AS v1(x1), v AS v2(x2);
[INFO ] 2023-01-17 11:02:17.531 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: WITH v(x) AS
(VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan'))
SELECT x1, x2,
x1 + x2 AS sum,
x1 - x2 AS diff,
x1 * x2 AS prod
FROM v AS v1(x1), v AS v2(x2);
[ERROR] 2023-01-17 11:02:17.540 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
org.postgresql.util.PSQLException: Bad value for type BigDecimal : Infinity
at org.postgresql.jdbc.PgResultSet.toBigDecimal(PgResultSet.java:3269)
at org.postgresql.jdbc.PgResultSet.toBigDecimal(PgResultSet.java:3278)
at org.postgresql.jdbc.PgResultSet.getNumeric(PgResultSet.java:2706)
at org.postgresql.jdbc.PgResultSet.internalGetObject(PgResultSet.java:226)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:2936)
at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
at org.apache.shardingsphere.infra.executor.sql.execute.result.query.impl.driver.jdbc.type.stream.JDBCStreamQueryResult.getValue(JDBCStreamQueryResult.java:106)
at org.apache.shardingsphere.infra.merge.result.impl.transparent.TransparentMergedResult.getValue(TransparentMergedResult.java:43)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.getRowData(DatabaseCommunicationEngine.java:348)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.simple.PostgreSQLComQueryExecutor.getQueryRowPacket(PostgreSQLComQueryExecutor.java:127)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.simple.PostgreSQLComQueryExecutor.getQueryRowPacket(PostgreSQLComQueryExecutor.java:61)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.writeDataPackets(PostgreSQLCommandExecuteEngine.java:113)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.processSimpleQuery(PostgreSQLCommandExecuteEngine.java:94)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.PostgreSQLCommandExecuteEngine.writeQueryData(PostgreSQLCommandExecuteEngine.java:85)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:116)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### Reason analyze (If you can)
I think the reason is similar with https://github.com/apache/shardingsphere/issues/23499
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
```sql
WITH v(x) AS
(VALUES('0'::numeric),('1'),('-1'),('4.2'),('inf'),('-inf'),('nan'))
SELECT x1, x2,
x1 + x2 AS sum,
x1 - x2 AS diff,
x1 * x2 AS prod
FROM v AS v1(x1), v AS v2(x2);
```
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] ShardingSphere-Proxy PostgreSQL Error: Bad value for type BigDecimal : Infinity [shardingsphere]
Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian closed issue #23597: ShardingSphere-Proxy PostgreSQL Error: Bad value for type BigDecimal : Infinity
URL: https://github.com/apache/shardingsphere/issues/23597
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org