Hi Ruben Thank you so much for the quick reply. Our Amount column was nullable now while defining the table columns, I am setting column as nullable and with this the issue is resolved.
Thanks, Mahadev ________________________________ From: Mahadev Mishal <mahadev.mis...@rockwellautomation.com> Sent: Friday, September 12, 2025 10:54 AM To: dev@calcite.apache.org <dev@calcite.apache.org> Cc: Vilas Dharma Suryawanshi <vilas.dharmasuryawan...@rockwellautomation.com> Subject: Question regarding SqlFunctions.toDouble(Object) null handling in Calcite 1.40.0 Hello Calcite Team, I am working with Apache Calcite 1.40.0 and encountered an issue related to the method org.apache.calcite.runtime.SqlFunctions.toDouble(Object o). When Calcite executes a query like: SELECT * FROM orders ORDER BY amount ASC; if the amount column contains NULL values, the execution fails with the following error: org.apache.calcite.runtime.CalciteException: Cannot convert null to double On inspecting the implementation of SqlFunctions.toDouble(Object), I noticed that it returns a primitive double. Since primitive types cannot hold null, the method eventually throws a cannotConvert(null, double.class) exception instead of handling null values gracefully. This raises a couple of questions: 1. What was the design reasoning behind skipping a null-check in this method? Or is this a possible oversight in the API design given that other SqlFunctions methods sometimes accept null? 2. Is there a recommended way to handle such cases? Looking forward to your insights and guidance. [Rockwell Automation]<https://www.rockwellautomation.com/> Mahadev Mishal Senior Software Engineer A-Wing Mississippi Bldg Embassy Tech Zone, Hinjewadi P2, Pune India M +91 9420886521 [Rockwell Automation Facebook]<https://www.facebook.com/ROKAutomation> [Rockwell Automation Instagram] <https://www.instagram.com/rokautomation/> [Rockwell Automation LinkedIn] <http://www.linkedin.com/company/rockwell-automation> [Rockwell Automation Twitter] <https://twitter.com/ROKAutomation>