Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast table properties based on its type in Faker connector #24597

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sthandassery
Copy link

@sthandassery sthandassery commented Dec 31, 2024

Description

Fixes setTableProperties on Faker connector. Table properties are now read, cast and set based on the predefined property type.

Previously it tried to set java.util.Optional values from properties map directly causing type compatibility issues. Along with the fix a test case has been added to validate intended behavior.

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

Copy link

cla-bot bot commented Dec 31, 2024

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@ebyhr
Copy link
Member

ebyhr commented Dec 31, 2024

Fixes #23911

Please don't use "Fixes" comment. We should add more tests in #23911.

@sthandassery
Copy link
Author

@nineinchnick can you please review?

.filter(entry -> !properties.containsKey(entry.getKey())),
properties.entrySet().stream()
.filter(entry -> entry.getValue().isPresent()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
Copy link
Member

Choose a reason for hiding this comment

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

Properties should already have correct types - would it be enough to add a get() here? Like:

.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get()));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants