[ 
https://issues.apache.org/jira/browse/CALCITE-4602?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17427933#comment-17427933
 ] 

Sergey Nuyanzin commented on CALCITE-4602:
------------------------------------------

{quote}
Sergey Nuyanzin, Now that Avatica 1.19 has been released, I'm testing the 
integration into Calcite. The test you added, 
JdbcTest.testIntAndBigDecimalInArray, no longer throws ClassCastException but 
now returns a nonsense result: the query select array[1, 1.1] returns the 
string "EXPR$0=[0E+1, 1.1]\n". Put a breakpoint in NumberAccessor.getBigDecimal 
and you will see the bogus "0E+1" value being created.

Do you think we should log a follow-up bug?
{quote}
yes, I think it is the only way...
I checked your tag and reproduced it. I will create a follow-up bug.

{quote}
Sergey Nuyanzin, By the way. You have 3 PRs that each adds a test case at the 
same point in JdbcTest. Guess what? I'm hitting loads of merge conflicts. 
Please don't just "stick a test case at the end".
{quote}

Sorry for such inconvenience... 
I admit, I forget about possible merge conflicts in such case. Will keep it in 
mind

> ClassCastException retrieving from ARRAY that has mixed INTEGER and DECIMAL 
> elements
> ------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4602
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4602
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: avatica-1.17.0
>            Reporter: Sergey Nuyanzin
>            Assignee: Sergey Nuyanzin
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: avatica-1.19.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Cases to reproduce: any query with array containing both int and bigdecimal 
> elements for instance
> {code:sql}
> select array[1, 1.1];
> select array[1.1, 1];
> {code}
> which leads to ClassCastException
> {noformat}
> class java.lang.Integer cannot be cast to class java.math.BigDecimal 
> (java.lang.Integer and java.math.BigDecimal are in module java.base of loader 
> 'bootstrap')
> java.lang.ClassCastException: class java.lang.Integer cannot be cast to class 
> java.math.BigDecimal (java.lang.Integer and java.math.BigDecimal are in 
> module java.base of loader 'bootstrap')
>       at 
> org.apache.calcite.avatica.util.AbstractCursor$BigDecimalAccessor.getBigDecimal(AbstractCursor.java:701)
>       at 
> org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.convertValue(AbstractCursor.java:1338)
>       at 
> org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getObject(AbstractCursor.java:1299)
>       at 
> org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getArray(AbstractCursor.java:1352)
>       at 
> org.apache.calcite.avatica.util.AbstractCursor$ArrayAccessor.getString(AbstractCursor.java:1364)
>       at 
> org.apache.calcite.avatica.AvaticaResultSet.getString(AvaticaResultSet.java:239)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to