Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add api for fetching federated query configs #339

Merged
merged 5 commits into from
Jul 10, 2024

Conversation

tiana528
Copy link
Contributor

@tiana528 tiana528 commented Jul 5, 2024

No description provided.

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.common.base.Objects;
Copy link
Contributor

Choose a reason for hiding this comment

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

In td-client-java, we have abolished usage of com.google.common.base.Objects,

Could you rewrite the class without using com.google.common.base.Objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Updated

@tiana528 tiana528 force-pushed the federated-query-support branch from ee048d8 to 38b0fef Compare July 8, 2024 03:20
@@ -1958,6 +1959,50 @@ public void testImportBytesWithId()
assertEquals(result.getUniqueId(), "4288048cf8f811e88b560a87157ac806");
}

@Test
public void testGetFederatedQueryConfigsWhenEmpty()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add test cases that the endpoint return 4xx status code?
The endpoint returns 401 and 403.

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 is not very convenient to simulate 401 and 403. I added a test case of 401, while it depends on the internal behaviour.
To support 401 and 403 in the test case, we need to configure the account of staging-aws used by the unit tests in a way to trigger 401 and 403 (Some junit tests in this class actually sends real request to staging-aws api3), which I feel might be a little too much.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure, I see.

Copy link
Contributor

@yuokada yuokada left a comment

Choose a reason for hiding this comment

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

LGTM

result = 31 * result + Objects.hashCode(createdAt);
result = 31 * result + Objects.hashCode(updatedAt);
result = 31 * result + Objects.hashCode(settings);
return result;
Copy link
Member

Choose a reason for hiding this comment

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

why not Objects.hash(id, type, userId, accountId, ...)

Copy link
Contributor

Choose a reason for hiding this comment

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

In my understanding, that code is automatically generated by IntelliJ or from any template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is generated by IntelliJ automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to Objects.hash(id, type, userId, accountId, ...)

@yuokada yuokada mentioned this pull request Jul 9, 2024
private final String updatedAt;

@JsonDeserialize(using = com.treasuredata.client.deserialize.FederatedQueryConfigSettingsDeserializer.class)
private final String settings;
Copy link
Member

Choose a reason for hiding this comment

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

If this is anonymous json serialized, Map<String, Object> should be enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated like that.

Copy link
Member

@miniway miniway left a comment

Choose a reason for hiding this comment

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

LGTM

@tiana528
Copy link
Contributor Author

Thank you!

@tiana528 tiana528 merged commit 0fe291b into master Jul 10, 2024
7 checks passed
@tiana528 tiana528 deleted the federated-query-support branch July 10, 2024 00:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants