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: reject incorrectly typed HEADER columns #8511

Merged
merged 3 commits into from
Dec 16, 2021
Merged

fix: reject incorrectly typed HEADER columns #8511

merged 3 commits into from
Dec 16, 2021

Conversation

jzaralim
Copy link
Contributor

Description

Fixes #8447

Throws an error if a user tries to create a source with a HEADER column with an incorrect type

Testing done

QTT and unit tests

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 #")

@jzaralim jzaralim requested a review from a team as a code owner December 14, 2021 21:03
@jzaralim jzaralim requested a review from spena December 14, 2021 21:03
@@ -91,6 +95,9 @@ public LogicalSchema toLogicalSchema() {
if (tableElement.getConstraints().isKey() || tableElement.getConstraints().isPrimaryKey()) {
builder.keyColumn(fieldName, fieldType);
} else if (tableElement.getConstraints().isHeaders()) {
throwOnIncorrectHeaderColumnType(
Copy link
Member

Choose a reason for hiding this comment

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

I think this check should be done earlier in the AstBuilder where the TableElement is created. My opinion is that once TableElement is created, then toLogicalSchema shouldn't fail. This method just converts from one object to another (unsure why isEmpty() fails, but it's already there). Also, the AstBuilder may check for invalid syntax, so why I think it should live there. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. Moved.

Copy link
Member

@spena spena left a comment

Choose a reason for hiding this comment

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

LGTM

@jzaralim jzaralim merged commit 1bb4e1a into master Dec 16, 2021
@jzaralim jzaralim deleted the header-type branch December 16, 2021 20:05
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.

Creating a stream with HEADERS does not fail if I specify a key/value type other than STRING/BYTES
2 participants