Skip to content

Fix query parameter replacement replacing partial parameter names #1543

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

Conversation

LeonLuttenberger
Copy link
Contributor

@LeonLuttenberger LeonLuttenberger commented Aug 24, 2022

Feature or Bugfix

  • Bugfix

Detail

The current parameter replacement might replace parameter names that are merely prefixes of another parameter name. For example, for a query like

SELECT *
FROM table
WHERE col = :col AND col = :col2

replacing col with "Name" would result in the following query:

SELECT *
FROM table
WHERE col = 'Name' AND col = 'Name'2

With the change I've implemented, the parameter substitution is making use of the Regex negative look ahead operator, which ensures that we are only replacing full tokens. Therefore, col2 will not be picked up by a replacement of col.

I also added the unit test test_read_sql_query_parameter_formatting_respects_prefixes, which will ensure this issue is caught by testing in the future.

Relates

#1542

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@LeonLuttenberger LeonLuttenberger changed the title fix: Fix query parameter replacement replacing partial parameter names Fix query parameter replacement replacing partial parameter names Aug 24, 2022
@LeonLuttenberger LeonLuttenberger self-assigned this Aug 24, 2022
@LeonLuttenberger LeonLuttenberger added this to the 3.0.0 milestone Aug 24, 2022
@LeonLuttenberger LeonLuttenberger added the bug Something isn't working label Aug 24, 2022
@LeonLuttenberger LeonLuttenberger linked an issue Aug 24, 2022 that may be closed by this pull request
@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubDistributedCodeBuild6-jWcl5DLmvupS
  • Commit ID: b82c046
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubDistributedCodeBuild6-jWcl5DLmvupS
  • Commit ID: b82c046
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubLoadTests5656BB24-s6u9F3qN9oFy
  • Commit ID: b82c046
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@LeonLuttenberger LeonLuttenberger marked this pull request as ready for review August 24, 2022 19:15
@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubDistributedCodeBuild6-jWcl5DLmvupS
  • Commit ID: b82c046
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubDistributedCodeBuild6-jWcl5DLmvupS
  • Commit ID: b82c046
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@malachi-constant
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: GitHubStandardCodeBuild8C06-llutOAimTATs
  • Commit ID: b82c046
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@LeonLuttenberger LeonLuttenberger merged commit b16e6e7 into release-3.0.0 Aug 25, 2022
@LeonLuttenberger LeonLuttenberger deleted the 1542-athena-query-formatter-not-working-correctly branch August 25, 2022 13:35
@LeonLuttenberger LeonLuttenberger added the breaking change Breaking change; must only be deployed as part of a major release and documented properly label Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Breaking change; must only be deployed as part of a major release and documented properly bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Athena query formatter not working correctly
4 participants