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: include lower-case identifiers among those that need quotes (#3723) #5139

Conversation

stevenpyzhang
Copy link
Member

Description

Backport #3723
Fixes #5032

Testing done

Describe the testing strategy. Unit and integration tests are expected for any behavior changes.

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

…fluentinc#3723)

IdentifierUtils::needsQuotes is used by various code that formats SQL text to
decide what identifiers to wrap in quotes. Before this change, this just included
reserved identifiers. However, identifiers that include lower-case characters should
also be quoted. Otherwise, when the parser parses them it will convert them to
upper-case. So this patch changes needsQuotes to check for lower-case characters.

For schema inference, we don't want to quote column names generated from lower-case
avro schema fields. To handle this, this patch adds IdentifierUtils.isValid, that
only returns true if the identifier is valid (parsable). Schema inference uses this
to only quote invalid identifiers.
@stevenpyzhang stevenpyzhang requested a review from a team as a code owner April 22, 2020 15:31
@agavra agavra self-assigned this Apr 22, 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!

@stevenpyzhang stevenpyzhang merged commit 3bcbcf4 into confluentinc:5.4.x Apr 22, 2020
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

3 participants