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
[2]
https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowWithGetters.java#L109-L144
[3]
https://github.com/apache/beam/blob/master/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/SelectHelpers.java#L267-L279
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/>