Skip to content

fix(stepfunctions-tasks): Athena StartQueryExecution includes QueryExecutionContext even when object is empty#16141

Merged
mergify[bot] merged 8 commits intoaws:masterfrom
LukvonStrom:master
Sep 3, 2021
Merged

fix(stepfunctions-tasks): Athena StartQueryExecution includes QueryExecutionContext even when object is empty#16141
mergify[bot] merged 8 commits intoaws:masterfrom
LukvonStrom:master

Conversation

@LukvonStrom
Copy link
Copy Markdown
Contributor

@LukvonStrom LukvonStrom commented Aug 20, 2021

fixes: #16133

As described in #16133, the empty QueryExecutionContext, which was included before this fix, leads to an error.
To mitigate this, I implemented a check to exclude the QueryExecutionContextwhen both params are empty.
This way, it behaves like a truly optional parameter.

Additionally I integrated an easier way to merge an OutputLocation if provided.
This means less redundancy than the original solution, which returned an object that was only different in one key in each branch.

The unittest is based on the default unittest, but a bit "stripped down". It proofs that no empty QueryExecutionContext object is present.

In my tests, this fixes the

{
  "resourceType": "athena",
  "resource": "startQueryExecution.sync",
  "error": "Athena.InvalidRequestException",
  "cause": "Both queryExecutionContext.catalog and queryExecutionContext.database are null or empty (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: [Censored]; Proxy: null)"
}

error.

This solution turned out to be a bit different than I envisioned in the issue.


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

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Aug 20, 2021

@peterwoodworth peterwoodworth changed the title fix(aws-stepfunctions-tasks): fixes #16133 - removes clientexecutioncontext, when empty fix(aws-stepfunctions-tasks): removes clientexecutioncontext, when empty Sep 1, 2021
@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p1 labels Sep 1, 2021
Copy link
Copy Markdown
Contributor

@BenChaimberg BenChaimberg left a comment

Choose a reason for hiding this comment

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

Thank you so much for cleaning up our logic! A couple of further modifications to make things sleek

Co-authored-by: Ben Chaimberg <youppi3@gmail.com>
@mergify mergify bot dismissed BenChaimberg’s stale review September 3, 2021 10:05

Pull request has been modified.

Copy link
Copy Markdown
Contributor

@BenChaimberg BenChaimberg left a comment

Choose a reason for hiding this comment

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

awesome, looks great! just some minor stuff

@mergify mergify bot dismissed BenChaimberg’s stale review September 3, 2021 17:30

Pull request has been modified.

@mergify mergify bot dismissed BenChaimberg’s stale review September 3, 2021 17:57

Pull request has been modified.

@BenChaimberg BenChaimberg changed the title fix(aws-stepfunctions-tasks): removes clientexecutioncontext, when empty fix(stepfunctions-tasks): Athena StartQueryExecution includes QueryExecutionContext even when object is empty Sep 3, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 3, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 9e7cec2
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit 6e2a3e0 into aws:master Sep 3, 2021
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Sep 3, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Sep 6, 2021
…ecutionContext even when object is empty (aws#16141)

fixes: aws#16133

As described in aws#16133, the empty  `QueryExecutionContext`, which was included before this fix, leads to an error.
To mitigate this, I implemented a check to exclude the  `QueryExecutionContext`when both params are empty.
This way, it behaves like a truly optional parameter.

Additionally I integrated an easier way to merge an OutputLocation if provided.
This means less redundancy than the original solution, which returned an object that was only different in one key in each branch.

The unittest is based on the default unittest, but a bit "stripped down". It proofs that no empty `QueryExecutionContext` object is present.

In my tests, this fixes the 
```
{
  "resourceType": "athena",
  "resource": "startQueryExecution.sync",
  "error": "Athena.InvalidRequestException",
  "cause": "Both queryExecutionContext.catalog and queryExecutionContext.database are null or empty (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: [Censored]; Proxy: null)"
}
```
error.


This solution turned out to be a bit different than I envisioned in the issue.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this pull request Sep 7, 2021
…ecutionContext even when object is empty (aws#16141)

fixes: aws#16133

As described in aws#16133, the empty  `QueryExecutionContext`, which was included before this fix, leads to an error.
To mitigate this, I implemented a check to exclude the  `QueryExecutionContext`when both params are empty.
This way, it behaves like a truly optional parameter.

Additionally I integrated an easier way to merge an OutputLocation if provided.
This means less redundancy than the original solution, which returned an object that was only different in one key in each branch.

The unittest is based on the default unittest, but a bit "stripped down". It proofs that no empty `QueryExecutionContext` object is present.

In my tests, this fixes the 
```
{
  "resourceType": "athena",
  "resource": "startQueryExecution.sync",
  "error": "Athena.InvalidRequestException",
  "cause": "Both queryExecutionContext.catalog and queryExecutionContext.database are null or empty (Service: AmazonAthena; Status Code: 400; Error Code: InvalidRequestException; Request ID: [Censored]; Proxy: null)"
}
```
error.


This solution turned out to be a bit different than I envisioned in the issue.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

@aws-cdk/aws-stepfunctions-tasks effort/small Small work item – less than a day of effort p1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-stepfunctions-tasks): Athena QueryExecutionContext on StartQueryExecution is superfluous and leads to error

4 participants