Issue 1:
Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Searched open and closed GitHub issues.

Read documentation: ShardingSphere Doc.

Please pay attention on issues you submitted, because we maybe need more details.

If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

ShardingSphere-4.0.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

Sharding-jdbc

Expected behavior

Don't match column is upper or lower case.

Actual behavior

throw error.

Reason analyze (If you can)

upper and lower case.

The issue like #5893

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

spring:
shardingsphere:
sharding:
encrypt-rule:
tables:
t_order:
columns:
phone:
encryptor: encryptor_aes_salt
plainColumn: PHONE
assistedQueryColumn: PHONE_ASSISTED
cipherColumn: PHONE_CIPHER

Example codes for reproduce this issue (such as a github link).

Issue 2:
Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Searched open and closed GitHub issues.

Read documentation: ShardingSphere Doc.

Please pay attention on issues you submitted, because we maybe need more details.

If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.1.2

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

proxy

Expected behavior

I use custom algorithm in shardingsphere-proxy, the version is 5.1.2 ,and config is :

schemaName: orders

dataSources:
db_0:
url: jdbc:mysql://127.0.0.1:3306/db_0?serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 10
db_1:
url: jdbc:mysql://127.0.0.1:3306/db_1?serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: 123456
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 10

rules:
- !SHARDING
tables:
t_order:
actualDataNodes: db_${0..1}.t_order_${0..3}
tableStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: t_order_inline
defaultDatabaseStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: db_modulo
defaultTableStrategy:
none:
shardingAlgorithms:
db_modulo:
type: CUSTOM_SHARD
t_order_inline:
type: INLINE
props:
algorithm-expression: t_order_${user_id % 2}

my MySQL version is 5.6.48; create table sql:

create database db_0;
CREATE TABLE `t_order_0` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`status` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `t_order_1` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` bigint(20) DEFAULT NULL,
`user_id` bigint(20) DEFAULT NULL,
`status` varchar(45) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

create database db_1;
...

my custom algorithm code

public class CustomShardingDbAlgorithm implements StandardShardingAlgorithm<Long> {
@Override
public String doSharding(Collection<String> availableTargetNames, PreciseShardingValue<Long> preciseShardingValue) {
Long shardCol = preciseShardingValue.getValue();
return null;
}
@Override
public String getType() {
return "CUSTOM_SHARD";
}
}

then I use navicat connect to sharding-proxy. Insert data using the SQL as follows

INSERT INTO `t_order` ( `order_id`, `user_id`, `status`) VALUES ( 100000 ,100000, 'test');

Exception occurred.

Actual behavior

[ERROR] 2022-07-08 17:21:52.112 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
at com.yuanian.shard.config.algorithm.CustomShardingDbAlgorithm.doSharding(CustomShardingDbAlgorithm.java:29)
at org.apache.shardingsphere.sharding.route.strategy.type.standard.StandardShardingStrategy.doSharding(StandardShardingStrategy.java:83)
at org.apache.shardingsphere.sharding.route.strategy.type.standard.StandardShardingStrategy.doSharding(StandardShardingStrategy.java:71)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeDataSources(ShardingStandardRoutingEngine.java:218)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route0(ShardingStandardRoutingEngine.java:206)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditionsWithCondition(ShardingStandardRoutingEngine.java:127)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.routeByShardingConditions(ShardingStandardRoutingEngine.java:117)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.getDataNodes(ShardingStandardRoutingEngine.java:94)
at org.apache.shardingsphere.sharding.route.engine.type.standard.ShardingStandardRoutingEngine.route(ShardingStandardRoutingEngine.java:70)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:58)
at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:45)
at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:69)
at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:55)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:58)
at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:47)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:127)
at org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDatabaseCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:73)
at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:61)
at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:103)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:116)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:81)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Reason analyze (If you can)

I think the exception happened here:SQLVisitorEngine# visit(ParseASTNode)

public <T> T visit(final ParseASTNode parseASTNode) {
ParseTreeVisitor<T> visitor = SQLVisitorFactory.newInstance(databaseType, visitorType, SQLVisitorRule.valueOf(parseASTNode.getRootNode().getClass()), props);
T result = parseASTNode.getRootNode().accept(visitor);
if (isParseComment) {
appendSQLComments(parseASTNode, result);
}
return result;
}

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

server.yaml

mode:
type: Cluster
repository:
type: ZooKeeper
props:
namespace: governance_local
server-lists: zkserver1:2181
retryIntervalMilliseconds: 600
timeToLiveSeconds: 1500
maxRetries: 3
overwrite: false

rules:
- !AUTHORITY
users:
- root@%:root
- sharding@:sharding
provider:
type: ALL_PRIVILEGES_PERMITTED
- !TRANSACTION
defaultType: LOCAL

props:
max-connections-size-per-query: 5 # 每次查询的最大连接消耗数
kernel-executor-size: 16
proxy-frontend-flush-threshold: 128
proxy-opentracing-enabled: false
proxy-hint-enabled: false
sql-show: false
check-table-metadata-enabled: false
show-process-list-enabled: false
proxy-backend-query-fetch-size: -1
check-duplicate-table-enabled: false
proxy-frontend-executor-size: 0
proxy-backend-executor-suitable: OLAP
proxy-frontend-max-connections: 0
sql-federation-enabled: false
proxy-backend-driver-type: JDBC
proxy-mysql-default-version: 5.6.48

Example codes for reproduce this issue (such as a github link).