<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<p dir="auto">Before report a bug, make sure you have:</p>
<ul dir="auto">
<li>Searched open and closed <a href="https://github.com/apache/shardingsphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="https://shardingsphere.apache.org/document/current/en/overview" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response anymore and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">ShardingSphere-4.0.1</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">Sharding-jdbc</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Don't match column is upper or lower case.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">throw error.</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">upper and lower case.<br>
The issue like <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="629210826" data-permission-text="Title is private" data-url="https://github.com/apache/shardingsphere/issues/5893" data-hovercard-type="issue" data-hovercard-url="/apache/shardingsphere/issues/5893/hovercard" href="https://github.com/apache/shardingsphere/issues/5893">#5893</a></p>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="spring: 
  shardingsphere:
    sharding: 
      encrypt-rule: 
        tables: 
          t_order: 
            columns: 
              phone:
                encryptor: encryptor_aes_salt
                plainColumn: PHONE
                assistedQueryColumn: PHONE_ASSISTED
                cipherColumn: PHONE_CIPHER"><pre class="notranslate"><code class="notranslate">spring: 
  shardingsphere:
    sharding: 
      encrypt-rule: 
        tables: 
          t_order: 
            columns: 
              phone:
                encryptor: encryptor_aes_salt
                plainColumn: PHONE
                assistedQueryColumn: PHONE_ASSISTED
                cipherColumn: PHONE_CIPHER
</code></pre></div>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<p dir="auto">Before report a bug, make sure you have:</p>
<ul dir="auto">
<li>Searched open and closed <a href="https://github.com/apache/shardingsphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="https://shardingsphere.apache.org/document/current/en/overview" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response anymore and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">5.1.2</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">proxy</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">I use custom  algorithm in shardingsphere-proxy, the version is 5.1.2 ,and config is :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="schemaName: orders

dataSources:
  db_0:
    url: jdbc:mysql://127.0.0.1:3306/db_0?serverTimezone=Asia/Shanghai&amp;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&amp;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}"><pre class="notranslate"><code class="notranslate">schemaName: orders

dataSources:
  db_0:
    url: jdbc:mysql://127.0.0.1:3306/db_0?serverTimezone=Asia/Shanghai&amp;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&amp;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}
</code></pre></div>
<p dir="auto">my MySQL version is  5.6.48; create table sql:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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;
..."><pre class="notranslate"><code class="notranslate">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;
...
</code></pre></div>
<p dir="auto">my custom algorithm code</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public class CustomShardingDbAlgorithm implements StandardShardingAlgorithm&lt;Long&gt; {
    @Override
    public String doSharding(Collection&lt;String&gt; availableTargetNames, PreciseShardingValue&lt;Long&gt; preciseShardingValue) {
        Long shardCol = preciseShardingValue.getValue();
        return null;
    }
 @Override
    public String getType() {
        return &quot;CUSTOM_SHARD&quot;;
    }
}"><pre class="notranslate"><code class="notranslate">public class CustomShardingDbAlgorithm implements StandardShardingAlgorithm&lt;Long&gt; {
    @Override
    public String doSharding(Collection&lt;String&gt; availableTargetNames, PreciseShardingValue&lt;Long&gt; preciseShardingValue) {
        Long shardCol = preciseShardingValue.getValue();
        return null;
    }
 @Override
    public String getType() {
        return "CUSTOM_SHARD";
    }
}
</code></pre></div>
<p dir="auto">then I use navicat connect to sharding-proxy.  Insert data using the SQL as follows</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSERT INTO `t_order` ( `order_id`, `user_id`, `status`) VALUES ( 100000 ,100000, 'test'); "><pre class="notranslate"><code class="notranslate">INSERT INTO `t_order` ( `order_id`, `user_id`, `status`) VALUES ( 100000 ,100000, 'test'); 
</code></pre></div>
<p dir="auto">Exception occurred.</p>
<h3 dir="auto">Actual behavior</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[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)
"><pre class="notranslate"><code class="notranslate">[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)

</code></pre></div>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">I think the exception happened here:<code class="notranslate">SQLVisitorEngine# visit(ParseASTNode)</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    public &lt;T&gt; T visit(final ParseASTNode parseASTNode) {
        ParseTreeVisitor&lt;T&gt; visitor = SQLVisitorFactory.newInstance(databaseType, visitorType, SQLVisitorRule.valueOf(parseASTNode.getRootNode().getClass()), props);
        T result = parseASTNode.getRootNode().accept(visitor);
        if (isParseComment) {
            appendSQLComments(parseASTNode, result);
        }
        return result;
    }"><pre class="notranslate"><code class="notranslate">    public &lt;T&gt; T visit(final ParseASTNode parseASTNode) {
        ParseTreeVisitor&lt;T&gt; visitor = SQLVisitorFactory.newInstance(databaseType, visitorType, SQLVisitorRule.valueOf(parseASTNode.getRootNode().getClass()), props);
        T result = parseASTNode.getRootNode().accept(visitor);
        if (isParseComment) {
            appendSQLComments(parseASTNode, result);
        }
        return result;
    }
</code></pre></div>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto">server.yaml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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"><pre class="notranslate"><code class="notranslate">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
</code></pre></div>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>