Ali Atıl
02/25/2025, 2:32 PMselect * from testtable where messageTime >= (now() - 60000) limit 1000000
Caused by: java.lang.RuntimeException: Error composing query plan for: select * from testtable where messageTime >= (now() - 60000) limit 1000000
at org.apache.pinot.query.QueryEnvironment.getTableNamesForQuery(QueryEnvironment.java:274)
at org.apache.pinot.controller.api.resources.PinotQueryResource.getMultiStageQueryResponse(PinotQueryResource.java:217)
... 27 more
Caused by: org.apache.calcite.runtime.CalciteContextException: From line 1, column 61 to line 1, column 73: Cannot apply '-' to arguments of type '<TIMESTAMP(0)> - <INTEGER>'. Supported form(s): '<NUMERIC> - <NUMERIC>'
'<DATETIME_INTERVAL> - <DATETIME_INTERVAL>'
'<DATETIME> - <DATETIME_INTERVAL>'
'<TIMESTAMP> - <TIMESTAMP>'
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Cannot apply '-' to arguments of type '<TIMESTAMP(0)> - <INTEGER>'. Supported form(s): '<NUMERIC> - <NUMERIC>'
'<DATETIME_INTERVAL> - <DATETIME_INTERVAL>'
'<DATETIME> - <DATETIME_INTERVAL>'
'<TIMESTAMP> - <TIMESTAMP>'
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method))Yash Mayya
02/25/2025, 5:08 PMNOW was incorrectly defined to return a LONG / BIGINT type but it actually should've been a TIMESTAMP type. So if you want to subtract a numeric value from NOW(), you'll need to add a cast to either side (CAST(NOW() AS BIGINT) for instance).Ali Atıl
02/26/2025, 6:50 AM