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 more than 7 days 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?

4.0.0-RC1

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

Sharding-JDBC

Expected behavior

The method ResultSetUtil.convertValue(final Object value, final Class<?> convertType) can process boolean value.

Actual behavior

when the convertType is boolan or Boolean and value is not null ,the method will throw ShardingException.

Reason analyze (If you can)

In general ,when we convert a value to a boolean ,the type of the value is String or Number ; the value is "true" or "false" or number.

So the code:

ResultSetUtil.zip

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

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

Issue 2:
Caused by: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ExpressionProjectionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment

at org.apache.shardingsphere.infra.binder.segment.insert.values.OnDuplicateUpdateContext.getValue(OnDuplicateUpdateContext.java:87) ~[shardingsphere-infra-binder-5.0.0-alpha.jar:5.0.0-alpha]

at org.apache.shardingsphere.encrypt.rewrite.parameter.impl.EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.lambda$rewrite$0(EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java:59) ~[shardingsphere-encrypt-rewrite-5.0.0-alpha.jar:5.0.0-alpha]

at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_73]

at org.apache.shardingsphere.encrypt.rewrite.parameter.impl.EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.rewrite(EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java:58) ~[shardingsphere-encrypt-rewrite-5.0.0-alpha.jar:5.0.0-alpha]

at

Which version of ShardingSphere did you use?

shardingsphere-jdbc:5.0.0-alpha

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

ShardingSphere-JDBC

Expected behavior

Actual behavior

Caused by: java.lang.ClassCastException: org.apache.shardingsphere.sql.parser.sql.common.segment.dml.item.ExpressionProjectionSegment cannot be cast to org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.simple.LiteralExpressionSegment

Reason analyze (If you can)

as follows sql, when i config 'name' use ENCRYPT, my sql like 'ON DUPLICATE KEY UPDATE name=VALUES(name)' will throw As above exception, but i change the sql like this 'ON DUPLICATE KEY UPDATE name=?', ENCRYPT is work good.

i trace the code, find ENCRYPT field will use OnDuplicateUpdateContext

public Object getValue(final int index) {

ExpressionSegment valueExpression = valueExpressions.get(index);

return valueExpression instanceof ParameterMarkerExpressionSegment ? parameters.get(getParameterIndex(valueExpression)) : ((LiteralExpressionSegment) valueExpression).getLiterals();

}

when name=VALUES(name) valueExpression will is ExpressionProjectionSegment, is not LiteralExpressionSegment so will throw as above exception.

when name=? valueExpression will is ParameterMarkerExpressionSegment , is work good.

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

INSERT INTO anchor_info (id, source, anchorId, name, avatar, status, createTime, updateTime) VALUES

(#{id,jdbcType=BIGINT}, #{source,jdbcType=VARCHAR}, #{anchorId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},

#{avatar,jdbcType=VARCHAR},#{status,jdbcType=TINYINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})

ON DUPLICATE KEY UPDATE name=VALUES(name),

updateTime=VALUES(updateTime);

rules:

!ENCRYPT

tables:

anchor_info:

columns:

name:

cipherColumn: name

encryptorName: aes

encryptors:

aes:

type: AES

props:

aes-key-value: abcdisjckel14003c2f8ea32cc1d59e5

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