You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "PeiMouRen (via GitHub)" <gi...@apache.org> on 2023/06/16 07:18:37 UTC
[GitHub] [shardingsphere] PeiMouRen opened a new issue, #26385: NPE was reported when using count(*) to query sharding table
PeiMouRen opened a new issue, #26385:
URL: https://github.com/apache/shardingsphere/issues/26385
## Bug Report
### Which version of ShardingSphere did you use?
5.3.2
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
proxy
### Expected behavior
get `count(*)` result by querying the sharding table
### Actual behavior
NPE was reported
![image](https://github.com/apache/shardingsphere/assets/46043280/6276e363-f69d-418f-8130-86b33c5a1066)
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
**sharding rule:**
```yaml
rules:
- !SHARDING
tables:
T_Service_Order:
actualDataNodes: ds_${0..7}.T_Service_Order
databaseStrategy:
standard:
shardingColumn: Super_Account_No
shardingAlgorithmName: database_mod
shardingAlgorithms:
database_mod:
type: MOD
props:
sharding-count: 8
```
**datasource:**
```yaml
dataSources:
ds_0:
url: jdbc:postgresql://127.0.0.1:5432/db0
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_1:
url: jdbc:postgresql://127.0.0.1:5432/db1
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_2:
url: jdbc:postgresql://127.0.0.1:5432/db2
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_3:
url: jdbc:postgresql://127.0.0.1:5432/db3
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_4:
url: jdbc:postgresql://127.0.0.1:5432/db4
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_5:
url: jdbc:postgresql://127.0.0.1:5432/db5
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_6:
url: jdbc:postgresql://127.0.0.1:5432/db6
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
ds_7:
url: jdbc:postgresql://127.0.0.1:5432/db7
username: test
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
```
**query data:**
```sql
select * from t_service_order;
```
![image](https://github.com/apache/shardingsphere/assets/46043280/fa30313b-0f78-4819-b239-184c1ec3e9c9)
![image](https://github.com/apache/shardingsphere/assets/46043280/47454a2e-be76-413c-a3e7-85b68050acf9)
**query count:**
```sql
select count(*) from t_service_order;
```
![image](https://github.com/apache/shardingsphere/assets/46043280/8f992643-2a8d-487e-9b25-0bcf3bf03b56)
![image](https://github.com/apache/shardingsphere/assets/46043280/d8e8912f-8c32-43dd-9526-4115e37d970f)
### Example codes for reproduce this issue (such as a github link).
--
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
[GitHub] [shardingsphere] PeiMouRen commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "PeiMouRen (via GitHub)" <gi...@apache.org>.
PeiMouRen commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1597983468
@RaigorJiang
After full testing, I found that the sharding-proxy is case-sensitive to the rule config in the configuration file(like `config-sharding.yml`), so I changed all the config to lower case. After that, if the table is in custom schema, when performing operations like `count(*)、group by、order by`, I need to add the schema name before the table name(like `a.t_order`, `a` is the schema name). If the table is in `public` schema, I do not need to add the schema name.
So the `search path` config will only take effect for normal queries(like `select * from t_order`)?
--
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
[GitHub] [shardingsphere] PeiMouRen closed issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "PeiMouRen (via GitHub)" <gi...@apache.org>.
PeiMouRen closed issue #26385: NPE was reported when using count(*) to query sharding table
URL: https://github.com/apache/shardingsphere/issues/26385
--
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
[GitHub] [shardingsphere] PeiMouRen commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "PeiMouRen (via GitHub)" <gi...@apache.org>.
PeiMouRen commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1594532871
These tables are placed in a custom pg schema, when i move table to the public schema, the above exception disappear. Does proxy not support pg schema now?
--
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
[GitHub] [shardingsphere] RaigorJiang commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1596381809
@PeiMouRen
There are plans to support specifying schema through search path, you can search keyword `search path` in issues.
--
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
[GitHub] [shardingsphere] RaigorJiang commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1594884592
> These tables are placed in a custom pg schema, when i move table to the public schema, the above exception disappear. Does proxy not support pg schema now?
Yes, currently only public schema is supported
--
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
[GitHub] [shardingsphere] PeiMouRen commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "PeiMouRen (via GitHub)" <gi...@apache.org>.
PeiMouRen commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1596337580
@RaigorJiang Is there any plan to support other schemas in the new version? In which version, if any, is support planned?
--
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
[GitHub] [shardingsphere] PeiMouRen commented on issue #26385: NPE was reported when using count(*) to query sharding table
Posted by "PeiMouRen (via GitHub)" <gi...@apache.org>.
PeiMouRen commented on issue #26385:
URL: https://github.com/apache/shardingsphere/issues/26385#issuecomment-1605909557
I don't know why, now I put the table in a custom schema, and after a few reboots and deleting the configuration in zookeeper, now proxy support queries like `count(*), group by, order by`, that is so strange.
--
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