Menu

#1388 java.lang.ClassCastException: with count(*) and union

current-release
closed-fixed
None
1
2015-06-30
2015-03-03
Ludovic I.
No

Hello,

When the following SQL requests, a classcast exception occurs on the server side, for instance using sqltool:

CREATE TABLE T (
V DECIMAL(28) NOT NULL,
);
SELECT MAX(V) + 1 FROM T UNION SELECT COUNT(*) + 1 FROM T;

On the hsqldb server logs:

2015-03-03 13:06:49.706 3 SELECT MAX(V) + 1 FROM T UNION SELECT COUNT(*) + 1 FROM T 
java.lang.ClassCastException: java.lang.Long cannot be cast to java.math.BigDecimal
        at org.hsqldb.rowio.RowOutputBase.writeData(RowOutputBase.java:232)
        at org.hsqldb.rowio.RowOutputBinary.writeData(RowOutputBinary.java:1)
        at org.hsqldb.rowio.RowOutputBase.writeData(RowOutputBase.java:187)
        at org.hsqldb.rowio.RowOutputBinary.writeData(RowOutputBinary.java:1)
        at org.hsqldb.navigator.RowSetNavigatorData.write(RowSetNavigatorData.java:317)
        at org.hsqldb.result.Result.write(Result.java:1269)
        at org.hsqldb.server.ServerConnection.receiveResult(ServerConnection.java:402)
        at org.hsqldb.server.ServerConnection.run(ServerConnection.java:1533)
        at java.lang.Thread.run(Thread.java:745)

I am using the last snapshot from svn, but it is reproducible with the 2.3.2.

Best regards,

Discussion

  • Fred Toussi

    Fred Toussi - 2015-03-03
    • status: open --> open-fixed
    • assigned_to: Fred Toussi
    • Priority: 5 --> 1
     
  • Fred Toussi

    Fred Toussi - 2015-03-03

    Thanks. Has been fixed and committed to SVN.

     
    • Ludovic I.

      Ludovic I. - 2015-03-03

      Thank you for the quick reply! Still, I have updated to the last snapshot from trunk [5430] but the problem remains. Could you please check?

       
  • Fred Toussi

    Fred Toussi - 2015-03-03

    It works fine here. Some changes to org.hsqldb.QuerySpecification were required.

     
    • Ludovic I.

      Ludovic I. - 2015-03-03

      Oups. It was my fault. I have just rechecked and I may been tricked by Eclipse. Many thanks for the support!

       
  • Fred Toussi

    Fred Toussi - 2015-06-30
    • Status: open-fixed --> closed-fixed
     

Log in to post a comment.