-
Notifications
You must be signed in to change notification settings - Fork 169
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
[FLINK-30702] Add Elasticsearch dialect #67
Conversation
@MartijnVisser Hi! I've fixed code formatting, so I think build can be rerun now. Thanks! |
9d951cf
to
68c4dda
Compare
@eskabetxe Could you review the PR, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @grzegorz8, thanks for your contribution.
I left some comments
but should be this PR on https://github.com/apache/flink-connector-elasticsearch ??
public ElasticsearchMetadata(ElasticsearchContainer container) { | ||
this.containerHost = container.getHost(); | ||
this.containerPort = container.getMappedPort(ELASTIC_PORT); | ||
this.username = USERNAME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we obtain this from container?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid not. We can only extract password from container envs (ELASTIC_PASSWORD
).
CONTAINER.start(); | ||
|
||
// JDBC plugin is available only in Platinum and Enterprise licenses or in trial. | ||
if (!getClient().trialEnabled()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartijnVisser can you validate this? I dont know if by license we can do this.
/** Elasticsearch docker images. */ | ||
public interface ElasticsearchImages { | ||
|
||
String ELASTICSEARCH_8 = "docker.elastic.co/elasticsearch/elasticsearch:8.8.1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for that specific version? current on 8.11.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8.8.1 was the latest one when I created the PR.
Version updated.
&& response.license.type.equals("trial"); | ||
} | ||
|
||
public void enableTrial() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartijnVisser here comes the real action
flink-connector-jdbc/pom.xml
Outdated
<postgres.version>42.5.1</postgres.version> | ||
<oracle.version>21.8.0.0</oracle.version> | ||
<trino.version>418</trino.version> | ||
<byte-buddy.version>1.12.10</byte-buddy.version> | ||
<elasticsearch.version>8.8.1</elasticsearch.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this version? last version is 8.11.1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version updated.
} | ||
|
||
@Override | ||
public Optional<String> getUpsertStatement( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if read is the only option for ES, this should be on documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean docs/content/docs/connectors/table/jdbc.md
? Which section is the most suitable one?
flink-connector-jdbc/pom.xml
Outdated
<postgres.version>42.5.1</postgres.version> | ||
<oracle.version>21.8.0.0</oracle.version> | ||
<trino.version>418</trino.version> | ||
<byte-buddy.version>1.12.10</byte-buddy.version> | ||
<elasticsearch.version>8.11.1</elasticsearch.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be really careful about what's included here, since the Elasticsearch dependency that's being references isn't an Apache-compatible license
Code that is licensed solely under the Elastic License 2.0 is found only in the x-pack folder.
https://github.com/elastic/elasticsearch/blob/main/LICENSE.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I'm not fully aware of all consequences of mixing licences here.
Below I summarize all elastic dependencies which are used:
-
org.elasticsearch.plugin:x-pack-sql-jdbc
- Elastic License 2.0 - The dependency hasprovided
scope so it will not be part of the connector "fat-jar". If someone wants to use it, has to add it to classpath/container/etc on their own. Does it make us "safe"? -
org.elasticsearch.client:elasticsearch-rest-client
(https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-client) used withtest
scope - Apache 2 License - we are safe here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartijnVisser Hi! What should be done to ensure if adding this dependency (even as "provided") is allowed? The same question for enabling Elastic trial for testing purposes.
Should I create a ticket somewhere? Write to [email protected]? What do you suggest? Or should we already close the PR and corresponding ticket due to incompatible license?
The license is not listed on Category X: https://www.apache.org/legal/resolved.html#category-x (nor in any other). Assuming Elastic License is "Category X", I think we are still safe, since we do not violate the following rules mentioned in the document: "They may not be distributed" and "You may rely on them when they support an optional feature".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should be done to ensure if adding this dependency (even as "provided") is allowed?
I think we should add an enforcer rule to make sure that it's never bundled. Next to that, I think we should make a similar statement in the docs as we've done for RabbitMQ (see https://nightlies.apache.org/flink/flink-docs-master/docs/connectors/datastream/rabbitmq/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MartijnVisser Both enforcer rule and statement about JDBC driver license have been added.
I just thought flink-connector-jdbc is the most suitable place - I merely add a JDBC dialect. This repo already contains lots of test utils that are used for elastic dialect as well. Alternatively, we can add a new module |
14d5978
to
c742808
Compare
c742808
to
ce985b9
Compare
Due to recent refactoring it was easier to create a new PR: #136 |
https://issues.apache.org/jira/browse/FLINK-30702