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

fix: allow dynamic construction of an ARRAY of STRUCTS with duplicate values #5436 #5506

Merged
merged 5 commits into from May 29, 2020

Conversation

nae701
Copy link
Contributor

@nae701 nae701 commented May 28, 2020

Description

What behavior do you want to change, why, how does your patch achieve the changes?
Error was occuring when user wants to create an array of structs with duplicate values. This patch fixes this by using a mutable hash map and then making an immutable hash map copy from that, since the immutable hash map builder did not check for duplicates but will fail once we try to build it.

Testing done

Describe the testing strategy. Unit and integration tests are expected for any behavior changes.
A new unit test was created in the create-struct.json that checks for this specific test case of duplicate values.

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@nae701 nae701 requested a review from agavra May 28, 2020 22:43
@nae701 nae701 requested a review from a team as a code owner May 28, 2020 22:43
@ghost
Copy link

ghost commented May 28, 2020

It looks like @nae701 hasn't signed our Contributor License Agreement, yet.

The purpose of a CLA is to ensure that the guardian of a project's outputs has the necessary ownership or grants of rights over all contributions to allow them to distribute under the chosen licence.
Wikipedia

You can read and sign our full Contributor License Agreement here.

Once you've signed reply with [clabot:check] to prove it.

Appreciation of efforts,

clabot

Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

This is great work @nae701! Opening your first ksqlDB PR in only 2 days is quite impressive. I have some comments inline that we'll need to address, and then we can be ready to merge

config/ksql-server.properties Outdated Show resolved Hide resolved
Comment on lines 126 to 127
final String structSchemaName = CodeGenUtil.schemaName(structSchemaCount++);
structToSchemaName.put(struct, structSchemaName);
if (!structToSchemaName.containsKey(struct)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should flip the semantics of the if statement here and instead return early if the structToSchemaName already contains the entry - that way we wont be incrementing structSchemaCount or adding the unnecessary argument to the argumentBuilder.

@agavra agavra self-assigned this May 28, 2020
Copy link
Contributor

@agavra agavra left a comment

Choose a reason for hiding this comment

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

LGTM! Feel free to merge when the Jenkins build is green. Congrats on your first ksql commit 🎉

@nae701 nae701 merged commit 0b1162c into confluentinc:master May 29, 2020
@nae701 nae701 deleted the issue_5436 branch May 29, 2020 18:37
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.

None yet

2 participants