<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/incubator-shardingsphere-example/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 <strong>more than 7 days</strong> 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">4.0.0-RC1</p>
<h3 dir="auto">Which project did you use? Sharding-JDBC or Sharding-Proxy?</h3>
<p dir="auto">Sharding-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">The method ResultSetUtil.convertValue(final Object value, final Class&lt;?&gt; convertType) can process boolean value.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">when the  convertType is boolan or Boolean and value is not null ,the method will throw ShardingException.</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">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.<br>
So the code:<br>
<a href="https://github.com/apache/incubator-shardingsphere/files/3357428/ResultSetUtil.zip">ResultSetUtil.zip</a></p>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<p dir="auto">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<br>
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]<br>
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]<br>
at java.util.Optional.ifPresent(Optional.java:159) ~[?:1.8.0_73]<br>
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]<br>
at</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">shardingsphere-jdbc:5.0.0-alpha</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">ShardingSphere-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">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</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<ol dir="auto">
<li>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.</li>
<li>i trace the code, find ENCRYPT field will use OnDuplicateUpdateContext<br>
public Object getValue(final int index) {<br>
ExpressionSegment valueExpression = valueExpressions.get(index);<br>
return valueExpression instanceof ParameterMarkerExpressionSegment ? parameters.get(getParameterIndex(valueExpression)) : ((LiteralExpressionSegment) valueExpression).getLiterals();<br>
}</li>
<li>when name=VALUES(name) valueExpression will is ExpressionProjectionSegment,  is not LiteralExpressionSegment so will throw as above exception.</li>
<li>when name=? valueExpression will is ParameterMarkerExpressionSegment ,  is work good.</li>
</ol>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto">INSERT INTO anchor_info (id, source, anchorId, name, avatar, status, createTime, updateTime) VALUES<br>
(#{id,jdbcType=BIGINT}, #{source,jdbcType=VARCHAR}, #{anchorId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},<br>
#{avatar,jdbcType=VARCHAR},#{status,jdbcType=TINYINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})<br>
ON DUPLICATE KEY UPDATE name=VALUES(name),<br>
updateTime=VALUES(updateTime);</p>
<p dir="auto">rules:</p>
<p dir="auto">!ENCRYPT<br>
tables:<br>
anchor_info:<br>
columns:<br>
name:<br>
cipherColumn: name<br>
encryptorName: aes<br>
encryptors:<br>
aes:<br>
type: AES<br>
props:<br>
aes-key-value: abcdisjckel14003c2f8ea32cc1d59e5</p>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>