flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Radu Tudoran <radu.tudo...@huawei.com>
Subject RE: TIMESTAMP TypeInformation
Date Tue, 25 Oct 2016 15:32:49 GMT
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?




Mime
View raw message