Thanks a lot for the clarification, Reuven. From: Reuven Lax <re...@google.com> Date: Tuesday, 29. March 2022 at 18:55 To: dev@beam.apache.org <dev@beam.apache.org> Subject: Re: [CODE QUESTION] Row getValues() vs getValue(int) getValues() is maybe poorly named - might be better called getRawValues. What you're looking for is probably the getBaseValues() method. getValues is mostly used in code that knows exactly what it's doing for optimization purposes. ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside your organization. Exercise caution when opening attachments or clicking any links. ZjQcmQRYFpfptBannerEnd getValues() is maybe poorly named - might be better called getRawValues. What you're looking for is probably the getBaseValues() method.
getValues is mostly used in code that knows exactly what it's doing for optimization purposes. It goes along with the attachValues method, which is similarly tricky to use. It's there to enable 0-copy code, but not necessarily intended for general consumption. On Tue, Mar 29, 2022 at 9:42 AM Moritz Mack <mm...@talend.com<mailto:mm...@talend.com>> wrote: Dear team, Is anybody around who could help me with a question on Schemas / Rows? That would be much appreciated! I’m particularly looking at RowWithGetters currently and I’m stuck understanding the semantics of Row.getValues() [1]. public List<Object> getValues() { return getters.stream().map(g -> g.get(getterTarget)).collect(Collectors.toList()); } What confuses me is that it works very different from getValue(fieldIdx), which applies quite some transformations [2] to the field value returned by the getter, e.g. converting logical types or wrapping raw values into another RowWithGetters for ROW types. I would have expected getValues() values to behave more like this example code: public List<Object> getValues() { return IntStream.range(0, getFieldCount()).mapToObj(this::getValue).collect(Collectors.toList()); } On the other hand, both getValues() and getValue(fieldIdx) seem to be used as if they are semantically the same, e.g. in SelectHelpers.selectIntoRow [3]. Is there a reason getValues() needs to return the raw values returned by the field getters? And how comes, both these can be used as if they are semantically the same in some cases, e.g. in selectIntoRow? Thanks so much, Moritz [1] https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java#L151-L154<https://urldefense.com/v3/__https:/github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java*L151-L154__;Iw!!CiXD_PY!XsNAEaElOkrWRK5ysblII4Jr5AyAseUUyNvsjcWg9o6YtLurfcZ_fvB6ktk__cpq0nCNtMXBrQ$> [2] https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java#L109-L144<https://urldefense.com/v3/__https:/github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java*L109-L144__;Iw!!CiXD_PY!XsNAEaElOkrWRK5ysblII4Jr5AyAseUUyNvsjcWg9o6YtLurfcZ_fvB6ktk__cpq0nCWJFpfQw$> [3] https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectHelpers.java#L267-L279<https://urldefense.com/v3/__https:/github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectHelpers.java*L267-L279__;Iw!!CiXD_PY!XsNAEaElOkrWRK5ysblII4Jr5AyAseUUyNvsjcWg9o6YtLurfcZ_fvB6ktk__cpq0nCTyH4nlg$> As a recipient of an email from Talend, your contact personal data will be on our systems. Please see our privacy notice. <https://www.talend.com/privacy/> As a recipient of an email from Talend, your contact personal data will be on our systems. Please see our privacy notice. <https://www.talend.com/privacy/>