Hello everyone, I am using 1.3.0. i am getting err...
# troubleshooting
a
Hello everyone, I am using 1.3.0. i am getting error when running below query when multiStageEngine is enabled. it was working before 1.3.0. Do you have any idea why its happening?
select * from testtable where messageTime >= (now() - 60000) limit 1000000
Copy code
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))
y
Hey @Ali Atıl, the multi-stage engine is strongly typed and you need to make sure that the types being added / subtracted are compatible. I think in previous releases
NOW
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).
a
thank you very much for your answer