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 support for user/password auth - Elasticsearch #16524

Merged
merged 5 commits into from
Dec 20, 2022

Conversation

v-jizhang
Copy link
Contributor

Cherry-pick of
trinodb/trino@bd4b3dd

Co-authored-by: Martin Traverso mtraverso@gmail.com

Test plan - (Please fill in how you tested your changes)

== RELEASE NOTES ==

ElasticSearch Connector Changes
* Add support for Elasticsearch user and password authentication.
   :issue:`15909`

@abmn614
Copy link

abmn614 commented Nov 22, 2021

Why hasn't this PR been submitted yet? Anyone knows some news?

@stale
Copy link

stale bot commented Sep 21, 2022

This pull request has been automatically marked as stale because it has not had recent activity. If you'd still like this PR merged, please comment on the task, make sure you've addressed reviewer comments, and rebase on the latest master. Thank you for your contributions!

@stale stale bot added the stale label Sep 21, 2022
@v-jizhang
Copy link
Contributor Author

Reviewed in #15877

@rschlussel rschlussel requested review from zhenxiao and removed request for aweisberg December 6, 2022 15:56
@stale stale bot removed stale labels Dec 6, 2022
@zhenxiao
Copy link
Collaborator

hi @v-jizhang could you please resolved the conflict?

@v-jizhang v-jizhang requested a review from a team as a code owner December 14, 2022 17:12
@v-jizhang v-jizhang requested a review from presto-oss December 14, 2022 17:12
Copy link
Contributor

@rschlussel rschlussel left a comment

Choose a reason for hiding this comment

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

I'll leave @zhenxiao to do a proper review, but just a couple things I noticed.

@@ -53,6 +54,11 @@ public QueryAssertions(Session session)
runner = new LocalQueryRunner(session);
Copy link
Contributor

Choose a reason for hiding this comment

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

would be good to update this constructor to call the new one
this(new LocalQueryRunner(requireNonNull(session, "session is null")))

@@ -108,8 +108,13 @@ public void addResults(QueryStatusInfo statusInfo, QueryData data)
throw new UncheckedIOException("Error loading data into Elasticsearch index: " + tableName, e);
}
}
client.bulk(request).actionGet();
client.admin().indices().flush(flushRequest(tableName)).actionGet();
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
Copy link
Contributor

Choose a reason for hiding this comment

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

static import IMMEDIATE

@@ -120,6 +120,9 @@ public static Session createSession()
public static void main(String[] args)
throws Exception
{
// To start Elasticsearch:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a readme too with any instructions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Working on it.

v-jizhang and others added 4 commits December 14, 2022 15:54
Cherry-pick of
trinodb/trino@bd4b3dd

Co-authored-by: Martin Traverso <mtraverso@gmail.com>
Cherry-pick of trinodb/trino#3331

Co-authored-by: Martin Traverso <mtraverso@gmail.com>
Cherry-pick of
trinodb/trino@7efb49c

Co-authored-by: Martin Traverso <mtraverso@gmail.com>
Cherry-pick of
trinodb/trino@a381258

Co-authored-by: Martin Traverso <mtraverso@gmail.com>
Copy link
Collaborator

@zhenxiao zhenxiao left a comment

Choose a reason for hiding this comment

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

hi @v-jizhang nice work
looks good. 2 minor things

@@ -32,7 +32,8 @@
{
public enum Security
{
AWS
AWS,
PASSWORD,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we remove the , after PASSWORD?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

@@ -57,12 +57,15 @@
protected QueryRunner createQueryRunner()
throws Exception
{
elasticsearch = new ElasticsearchServer();
elasticsearch = new ElasticsearchServer("docker.elastic.co/elasticsearch/elasticsearch-oss:6.0.0", ImmutableMap.of());
Copy link
Collaborator

Choose a reason for hiding this comment

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

shall we make it a constant or configurable?
docker.elastic.co/elasticsearch/elasticsearch-oss:6.0.0

Copy link
Collaborator

Choose a reason for hiding this comment

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

kindly ping

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made it a constant. Thanks for your reviews.

@v-jizhang v-jizhang force-pushed the elastic_password_2 branch 2 times, most recently from 702ffe7 to 84ee838 Compare December 16, 2022 02:33
@zhenxiao
Copy link
Collaborator

looks good. @v-jizhang could you please take a look at the 2 failing tests?

@zhenxiao
Copy link
Collaborator

nice. thank you, @v-jizhang could you please merge the last commit into previous ones?
I plan to merge this PR after the change

Cherry-pick of trinodb/trino#4165

Co-authored-by: Martin Traverso <mtraverso@gmail.com>
@zhenxiao zhenxiao merged commit 1c4822c into prestodb:master Dec 20, 2022
@wanglinsong wanglinsong mentioned this pull request Jan 12, 2023
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants