Long to Timestamp(3) Conversion

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Long to Timestamp(3) Conversion

Aeden Jameson
I've probably overlooked something simple, but when converting a
datastream to a table how does one convert a long to timestamp(3) that
will not be your event or proc time.

I've tried

        tEnv.createTemporaryView(
                "myTable"
                ,myDatastream
                ,....
                ,$("myLongTS").toTimestamp()
        )
which produces the exception,

org.apache.flink.table.api.ValidationException: Field reference
expression or alias on field expression expected.

I've also tried,

$("myLongTS").toTimestamp().as("myLongTS")
$("myLongTS as myLongTS").toTimestamp()

Haven't found Gooogling to be of much help on this one.

--
Thank You,
Aeden
Reply | Threaded
Open this post in threaded view
|

Re: Long to Timestamp(3) Conversion

Matthias
Hi Aeden,
there are some improvements to time conversions coming up in Flink 1.13. For now, the best solution to overcome this is to provide a user-defined function.

Hope, that helps.
Best,
Matthias

On Wed, Apr 21, 2021 at 9:36 PM Aeden Jameson <[hidden email]> wrote:
I've probably overlooked something simple, but when converting a
datastream to a table how does one convert a long to timestamp(3) that
will not be your event or proc time.

I've tried

        tEnv.createTemporaryView(
                "myTable"
                ,myDatastream
                ,....
                ,$("myLongTS").toTimestamp()
        )
which produces the exception,

org.apache.flink.table.api.ValidationException: Field reference
expression or alias on field expression expected.

I've also tried,

$("myLongTS").toTimestamp().as("myLongTS")
$("myLongTS as myLongTS").toTimestamp()

Haven't found Gooogling to be of much help on this one.

--
Thank You,
Aeden