Skip to content

[FLINK-40356][table] Add new MapFromEntries function - #28948

Open
VasShabu wants to merge 1 commit into
apache:masterfrom
VasShabu:MapFromEntriesImplementation
Open

[FLINK-40356][table] Add new MapFromEntries function#28948
VasShabu wants to merge 1 commit into
apache:masterfrom
VasShabu:MapFromEntriesImplementation

Conversation

@VasShabu

Copy link
Copy Markdown
Contributor

What is the purpose of the change

The Purpose of this change was to add a new builtin function, MapFromEntries Function to Flink

Brief change log

-Added mapFromEntries functionality
-Wired mapFromEntries function to flink

Verifying this change

Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.

(Please pick either of the following options)

This change is already covered by existing tests, such as the ones located in

to run test you need to run this command:
./mvnw -o -pl flink-table/flink-table-planner -Dtest='JsonFunctionsITCase' -Dsurefire.failIfNoSpecifiedTests=false -Dcheckstyle.skip=true -Dspotless.check.skip=true -Drat.skip=true -e -Denforcer.skip=true test

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (don't know)
  • The runtime per-record code paths (performance sensitive): (don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (yes)
  • If yes, how is the feature documented? (sql_fuunctions.yml,javadocs,pythonDocs)

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Opus 5

@flinkbot

flinkbot commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

Comment on lines +77 to +93
final Map<ObjectContainer, Object> entries = new LinkedHashMap<>();
for (int pos = 0; pos < input.size(); pos++) {
final RowData entry = (RowData) entryElementGetter.getElementOrNull(input, pos);
if (entry == null) {
return null;
}
entries.put(
wrapKey(keyFieldGetter.getFieldOrNull(entry)),
valueFieldGetter.getFieldOrNull(entry));
}
return new MapDataForMapFromEntries(
new GenericArrayData(
entries.keySet().stream()
.map(key -> key == null ? null : key.getObject())
.toArray()),
new GenericArrayData(entries.values().toArray()));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is a hot path executing during runtime.
We should avoid extra array creation and other things which might be optimized

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.

3 participants