You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dawid Wysakowicz (Jira)" <ji...@apache.org> on 2020/04/17 14:00:00 UTC

[jira] [Updated] (FLINK-17222) Improve FieldsDataType

     [ https://issues.apache.org/jira/browse/FLINK-17222?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dawid Wysakowicz updated FLINK-17222:
-------------------------------------
    Description: 
The problem with {{FieldsDataType}} is that the method {{getFieldDataTypes}} does not keep the order of the fields stored in the logical type. Therefore at couple of locations we have to first iterate over the names in logical type and then get the DataTypes.

{code}
final RowType rowType = (RowType) fieldsDataType.getLogicalType();
final String[] fieldNames = rowType.getFields()
	.stream()
	.map(RowType.RowField::getName)
	.toArray(String[]::new);

final TypeInformation<?>[] fieldTypes = Stream.of(fieldNames)
	.map(name -> fieldsDataType.getFieldDataTypes().get(name))
	.map(LegacyTypeInfoDataTypeConverter::toLegacyTypeInfo)
	.toArray(TypeInformation[]::new);
{code}

  was:
The problem with {{FieldsDataType}} is that the method {{getFieldDataTypes}} does not keep the order of the fields stored in the logical type. Therefore at couple of locations we have to first iterate over the names in logical type and then get the DataTypes.

{code}
		final RowType rowType = (RowType) fieldsDataType.getLogicalType();
		final String[] fieldNames = rowType.getFields()
			.stream()
			.map(RowType.RowField::getName)
			.toArray(String[]::new);

		final TypeInformation<?>[] fieldTypes = Stream.of(fieldNames)
			.map(name -> fieldsDataType.getFieldDataTypes().get(name))
			.map(LegacyTypeInfoDataTypeConverter::toLegacyTypeInfo)
			.toArray(TypeInformation[]::new);
{code}


> Improve FieldsDataType
> ----------------------
>
>                 Key: FLINK-17222
>                 URL: https://issues.apache.org/jira/browse/FLINK-17222
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Dawid Wysakowicz
>            Priority: Minor
>
> The problem with {{FieldsDataType}} is that the method {{getFieldDataTypes}} does not keep the order of the fields stored in the logical type. Therefore at couple of locations we have to first iterate over the names in logical type and then get the DataTypes.
> {code}
> final RowType rowType = (RowType) fieldsDataType.getLogicalType();
> final String[] fieldNames = rowType.getFields()
> 	.stream()
> 	.map(RowType.RowField::getName)
> 	.toArray(String[]::new);
> final TypeInformation<?>[] fieldTypes = Stream.of(fieldNames)
> 	.map(name -> fieldsDataType.getFieldDataTypes().get(name))
> 	.map(LegacyTypeInfoDataTypeConverter::toLegacyTypeInfo)
> 	.toArray(TypeInformation[]::new);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)