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

add missing location arguments for JobReference struct #221

Merged

Conversation

0kate
Copy link
Contributor

@0kate 0kate commented Feb 7, 2025

This PR ensures that the missing location argument is properly passed to the JobReference in the error handler that runs when a duplicate job entry is inserted.

Please review the changes.

joker1007
joker1007 previously approved these changes Feb 9, 2025
@joker1007 joker1007 dismissed their stale review February 9, 2025 20:56

wrong review

@@ -167,7 +167,7 @@ def create_load_job(chunk_id, chunk_id_hex, project, dataset, table_id, upload_s
log.error "job.load API", project_id: project, dataset: dataset, table: table_id, code: e.status_code, message: e.message

if job_id && e.status_code == 409 && e.message =~ /Job/ # duplicate load job
return JobReference.new(chunk_id, chunk_id_hex, project, dataset, table_id, job_id)
return JobReference.new(chunk_id, chunk_id_hex, project, dataset, table_id, job_id, res.job_reference.location)
Copy link
Collaborator

@joker1007 joker1007 Feb 9, 2025

Choose a reason for hiding this comment

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

Because the res variable is the return of insert_job, I cannot use the res variable in the case of failure of insert_job.

It is necessary to reacquire the location separately.
For example, you can use dataset get API.

Copy link
Contributor Author

@0kate 0kate Feb 10, 2025

Choose a reason for hiding this comment

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

Thank you for your reviews!
I have modified it to use the data obtained during the table existence check as the location in case of duplication. bc6c534

https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/BigqueryV2/Table.html

@0kate 0kate requested a review from joker1007 February 10, 2025 09:16
Copy link
Collaborator

@joker1007 joker1007 left a comment

Choose a reason for hiding this comment

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

Nice fix! 👍
Thank you very much!

@joker1007 joker1007 merged commit 83ceb34 into fluent-plugins-nursery:master Feb 10, 2025
8 checks passed
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