I'm having trouble dealing with a DataStream of POJOs. In particular, when I perform SQL operations on it I can't figure out the syntax for referring to individual fields within the POJO. Below is an example that illustrates the problem and the various approaches I've tried. Can anyone please point me in the right direction? import java.util.Arrays; |
Hi Chris, First thing, FxRate is not POJO, a POJO should have a constructor without arguments. In this way, you can read from a POJO DataStream directly. Second, if you want get field from POJO, please use get function like: fx.get('currency'), if you have a POJO field, you can use this way to get nested field from POJO. Best, Jingsong Lee On Wed, Dec 4, 2019 at 12:33 AM Chris Miller <[hidden email]> wrote:
Best, Jingsong Lee |
Thank you, adding the missing constructor has done the trick! (FWIW: my 'real' code is in Kotlin and I had a data class with no @JvmOverloads or empty secondary constructor). I haven't seen the fx.get('currency') field access syntax anywhere in the documentation, do you happen to know where I can read about that? The only thing I found was https://ci.apache.org/projects/flink/flink-docs-stable/dev/api_concepts.html#define-keys-using-field-expressions which is why I was trying the "fx.currency" style syntax instead. Many thanks for your help, Chris ------ Original Message ------
From: "Jingsong Lee" <[hidden email]>
To: "Chris Miller" <[hidden email]>
Cc: "user" <[hidden email]>
Sent: 04/12/2019 03:41:05
Subject: Re: Add time attribute column to POJO stream
|
Free forum by Nabble | Edit this page |