Hi Radu, I might not have complete understood your problem, but if you do
val env = StreamExecutionEnvironment.getExecutionEnvironment val tEnv = TableEnvironment.getTableEnvironment(env) val ds = env.fromElements( (1, 1L, new Time(1,2,3)) ) val t = ds.toTable(tEnv, 'a, 'b, 'c) val results = t .select('c + 10.seconds) then field 'c will be of type SqlTimeTypeInfo and handled as such. Hope this helps, Fabian 2016-10-25 17:32 GMT+02:00 Radu Tudoran <radu.tudo...@huawei.com>: > Re-hi, > > > > I actually realized that the problem comes from the fact that the > datastream that I am registering does not create properly the types. > > > > I am using something like > > > > DataStream<Tuple> … .returns(“TupleX<,….,java.sql.Timestamp, > java.sql.Time>”)…and I was expecting that these will be converted to > SqlTimeTypeInfo…but it is converted to GenericType. Anythoughts how I could > force the type to be recognize as a SqlTimeType? > > > > > > *From:* Radu Tudoran > *Sent:* Tuesday, October 25, 2016 4:46 PM > *To:* 'user@flink.apache.org' > *Subject:* TIMESTAMP TypeInformation > > > > Hi, > > > > I would like to create a TIMESTAMP type from the data schema. I would need > this to match against the FlinkTypeFactory (toTypeInfo()) > > > > *def* toTypeInfo(relDataType: RelDataType): TypeInformation[_] = > relDataType.getSqlTypeName *match* { > > *case* BOOLEAN => BOOLEAN_TYPE_INFO > > *case* TINYINT => BYTE_TYPE_INFO > > *case* SMALLINT => SHORT_TYPE_INFO > > *case* INTEGER => INT_TYPE_INFO > > *case* BIGINT => LONG_TYPE_INFO > > *case* FLOAT => FLOAT_TYPE_INFO > > *case* DOUBLE => DOUBLE_TYPE_INFO > > *case* VARCHAR | CHAR => STRING_TYPE_INFO > > *case* DECIMAL => BIG_DEC_TYPE_INFO > > > > // date/time types > > *case* DATE => SqlTimeTypeInfo.DATE > > *case* TIME => SqlTimeTypeInfo.TIME > > *case* *TIMESTAMP** => SqlTimeTypeInfo.**TIMESTAMP* > > > > I tried to use create the TypeInformation by calling directly > SqlTimeTypeInfo.TIMESTAMP . However, it seems that > relDataType.getSqlTypeName match is of type ANY instead of being of type > TIMESTAMP. > > > > Any thoughts of how to create the proper TIMESTAMP typeinformation? > > > > > > >