If your ROWTIME field is a BIGINT then the RANGE must be the same type as the
difference between two BIGINTs, i.e. a BIGINT.
> On Oct 21, 2016, at 9:44 AM, Radu Tudoran <radu.tudo...@huawei.com> wrote:
>
> Hi,
>
> I am trying to parse a query similar with the example on the Calcite web page
>
> SELECT STREAM
> SUM(units) OVER (ORDER BY rowtime RANGE INTERVAL '1' HOUR PRECEDING)
> unitsLastHour
> FROM Orders;
>
> In the original data the type of rowtime field is BIGINT (converted from java
> long). However, when validating the query I get an error for type mistmatch
> between ORDER BY and RANGE as shown below. I was curious what type should I
> have for rowtime for this to work. Also, if you can point me where I can
> override the mapping between the long and BIGINT to replace it to a
> mapping/transformation to whatever type is needed it will be great.
>
> Exception in thread "main" org.apache.calcite.tools.ValidationException:
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 77 to
> line 1, column 93: Data Type mismatch between ORDER BY and RANGE clause
>
> Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Data Type
> mismatch between ORDER BY and RANGE clause
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
> at
> org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:405)
> at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:514)
> ... 28 more