You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Aeden Jameson <ae...@gmail.com> on 2021/04/21 19:36:17 UTC

Long to Timestamp(3) Conversion

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

Re: Long to Timestamp(3) Conversion

Posted by Matthias Pohl <ma...@ververica.com>.
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 <ae...@gmail.com>
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