Skip to content

[client][hotfix] Invoke RowType#getFieldNames only once in ConverterCommons#1920

Merged
polyzos merged 1 commit into
apache:mainfrom
snuyanzin:fields
Nov 4, 2025
Merged

[client][hotfix] Invoke RowType#getFieldNames only once in ConverterCommons#1920
polyzos merged 1 commit into
apache:mainfrom
snuyanzin:fields

Conversation

@snuyanzin
Copy link
Copy Markdown
Contributor

Purpose

It is a small optimization to avoid calling RowType#getFieldNames inside a loop since each time it should through fields and create a new collection of names

Brief change log

Tests

API and Format

Documentation

pojoNames, fieldNames));
}
for (int i = 0; i < tableSchema.getFieldCount(); i++) {
String name = tableSchema.getFieldNames().get(i);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid calling it inside a loop since each call generates a new collection

public List<String> getFieldNames() {
return fields.stream().map(DataField::getName).collect(Collectors.toList());
}

@snuyanzin
Copy link
Copy Markdown
Contributor Author

fyi @polyzos

@polyzos polyzos merged commit 69d03e1 into apache:main Nov 4, 2025
5 checks passed
Ugbot pushed a commit to Ugbot/fluss that referenced this pull request Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants