[
https://issues.apache.org/jira/browse/FLINK-24399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17421422#comment-17421422
]
Timo Walther commented on FLINK-24399:
--------------------------------------
[~slinkydeveloper] I would also prefer to keep the API slim but this leads to
multiple util classes at different locations in the code base that basically do
the same thing. History has shown that. Having those frequently used methods in
{{DataType}} directly would make a lot of users happy. I'm sure we will need
more utilities but so far the mentioned methods are very frequent. Dealing with
rows needs projection all the time. {{flattenToNames}} does more than what is
usually required in a connector and would be different from {{getFieldNames}}.
[~airblader] Feel free to suggest a better name for {{getPhysicalRowDataType}}.
I'm fine with {{getFieldTypes}} and {{projectFields}}.
> Make handling of DataType less verbose
> --------------------------------------
>
> Key: FLINK-24399
> URL: https://issues.apache.org/jira/browse/FLINK-24399
> Project: Flink
> Issue Type: Improvement
> Components: Table SQL / API
> Reporter: Timo Walther
> Assignee: Francesco Guardiani
> Priority: Major
>
> {{DataType}} is the API abstraction for declaring types and always includes
> the {{LogicalType}} as well. In order to ease the handling of this class, we
> should do the following additions:
> - {{DynamicTableFactory.Context#getPhysicalRowDataType(): DataType}}
> - {{DynamicTableFactory.Context#getPrimaryKeyFields(): int[]}}
> - {{DataType#getFieldNames: List<String>}} (empty for atomics)
> - {{DataType#getFieldDataTypes: List<DataType>}} as a synonym for
> {{getChildren}} (empty for atomics)
> - {{DataType#getFieldCount: int}} (0 for atomics)
> - {{DataType#getProjectedFields(int[][]): DataType}} (like
> {{DataTypeUtils#projectRow}})
> - {{DataType#getProjectedFields(int[]): DataType}} (like
> {{DataTypeUtils#projectRow}})
> This should simplify implementations and avoid needs for internal utilities.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)