You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Julian Hyde <jh...@apache.org> on 2016/11/01 21:37:05 UTC
Re: monotonic column not working
Monotonic columns aren’t fully implemented yet. I use them as a concept in the streaming SQL examples, and they will be central when we’ve fully implemented streaming SQL (although people might also use related concepts like watermarks and partially-sorted columns).
We have some support for deducing monotonic expressions: if, say, x and y are ascending, then we can deduce that so is x + y.
But we can’t yet declare columns to be monotonic. SqlValidatorTest.testStreamGroupBy relies on MockCatalogReader.MockTable’s dummy implementation of getMonotonicity(String columnName).
This is very much a work in progress. (Contributions welcome, of course!)
Julian
> On Oct 31, 2016, at 10:30 AM, Nuwan Abeysiriwardana <nu...@gmail.com> wrote:
>
> Hi All,
>
> i have create a table which handle stream of java hashmap pair with the
> rowTime column. abstract table getRowType implementation given below.
>
> @Override
> public RelDataType getRowType(RelDataTypeFactory typeFactory) {
> return typeFactory.builder().add("_MAP",
> typeFactory.createMapType(
> typeFactory.createSqlType(SqlTypeName.VARCHAR),
> typeFactory.createTypeWithNullability(
> typeFactory.createSqlType(SqlTypeName.ANY),
> true))).add("rowTime",typeFactory.createSqlType(SqlTypeName.TIMESTAMP)).build();
> }
>
> idea is to use order by with floor(rowTime TO HOUR) .sample query as
> follows.
>
> select stream _MAP['name'],rowTime from event where cast(_MAP['age'] as INT
> ) >= 10 order by floor(event.rowTime TO HOUR)
>
> it giving me error saying : 'Streaming ORDER BY must start with monotonic
> expression'
>
> i can't find any special handling in the sample csv stream implementation
> as well.
>
> following query works fine.
> select stream _MAP['name'],rowTime from event
>
> so that means rowTime identified properly as timestamp.
> please help.
>
> calcite version :
> <dependency>
> <groupId>org.apache.calcite</groupId>
> <artifactId>calcite-core</artifactId>
> <version>1.10.0</version>
> </dependency>
>
> thanks
> nuwan