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: the QTTs now run through SqlFormatter & various other formatting fixes #3222

Merged
merged 1 commit into from
Aug 15, 2019

Conversation

agavra
Copy link
Contributor

@agavra agavra commented Aug 15, 2019

Co-authored-by: Sergio Peña [email protected]

Description

This reinstates #3037 into the current code path for the new testing tool. It also fixes some issues:

  • SqlFormatInjector was allowing statements that cannot be parsed to go through in order to appease some tests. This is no longer the case
  • SqlFormatter adds some formatting for statements that don't need it, but go through the testing path
  • fix: create persistent queries fail with reserved words #3216 is applied (thanks @spena co-authored)
  • SqlFormatter now properly escapes identifiers nested in structs
  • ensure-formatter.json was added to make sure that a future refactor does not skip this code path

Testing done

  • unit testing
  • ensure-formatter.json

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

@agavra agavra requested a review from spena August 15, 2019 21:13
@agavra agavra requested a review from a team as a code owner August 15, 2019 21:13
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.

It looks good.

I just left a question in the QTT test. I'm not sure how to interpret a possible failure on that test. Why would it fail if the SqlFormatter is not called?

"outputs": [ ],
"expectedException": {
"type": "io.confluent.ksql.util.KsqlException",
"message": "Unable to format statement!"
Copy link
Member

Choose a reason for hiding this comment

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

I could not understand why this could fail. Could you explain in the comment what can go wrong that would make this to fail? I see a CREATE command which will be persisted in the command topic. How can this fail if the SqlFormatter is not called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a little hacky, but SET calls fail to format (they're not supported in SqlFormatter). This test makes sure that a failure does happen. Without running through the SqlFormatter, a different failure happens - not ("Unable to format statement!")

@spena spena requested a review from a team August 15, 2019 21:26
@agavra agavra merged commit 79da68c into confluentinc:master Aug 15, 2019
@agavra agavra deleted the qtt_format branch August 15, 2019 21:59
@spena spena mentioned this pull request Aug 16, 2019
2 tasks
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