[
https://issues.apache.org/jira/browse/CALCITE-2198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17244730#comment-17244730
]
Alessandro Solimando edited comment on CALCITE-2198 at 12/6/20, 4:26 PM:
-------------------------------------------------------------------------
-I might be wrong, but the test case to reproduce the issue seems to have been
there for a while (see
[RexProgramTest.java#L2192|https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java#L2192]),
and the test case itself is passing, does this mean the issue can be closed as
resolved?-
Sorry, by skimming the code I have missed the surrounding "new
ByteString(...)", my bad!
was (Author: asolimando):
I might be wrong, but the test case to reproduce the issue seems to have been
there for a while (see
[RexProgramTest.java#L2192|https://github.com/apache/calcite/blob/master/core/src/test/java/org/apache/calcite/rex/RexProgramTest.java#L2192]),
and the test case itself is passing, does this mean the issue can be closed as
resolved?
> ClassCastException in RexBuilder when makeLiteral for BINARY and VARBINARY
> --------------------------------------------------------------------------
>
> Key: CALCITE-2198
> URL: https://issues.apache.org/jira/browse/CALCITE-2198
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Hequn Cheng
> Priority: Major
>
> Currently, makeLiteral for {{BINARY}} and {{VARBINARY}} will throw
> {{ClassCastException}} when value type is {{byte[]}}:
> {code:java}
> java.lang.ClassCastException: [B cannot be cast to
> org.apache.calcite.avatica.util.ByteString
> at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:1336)
> at
> org.apache.calcite.test.RexProgramTest.testSimplifyCastLiteral(RexProgramTest.java:1567){code}
> The exception can be reproduced by the following test case(in
> RexProgramTest.testSimplifyCastLiteral()):
> {code:java}
> literals.add((RexLiteral)
> rexBuilder.makeLiteral(new byte[] {1, 2, -34, 0, -128},
> typeFactory.createSqlType(SqlTypeName.BINARY, 5), false));{code}
> To avoid this exception we have to add support for type of {{byte[]}}. One
> choice is to convert {{byte[]}} to {{ByteString}} in {{RexBuilder.clean()}}.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)