Benchao Li created FLINK-16266:
----------------------------------
Summary: es6 & 7 table sql connector conflicts each other
Key: FLINK-16266
URL:
https://issues.apache.org/jira/browse/FLINK-16266 Project: Flink
Issue Type: Bug
Components: Connectors / ElasticSearch
Affects Versions: 1.10.0
Reporter: Benchao Li
If we put {{flink-sql-connector-elasticsearch6}} and {{flink-sql-connector-elasticsearch7}} into {{/lib}} at the same time, and use it in {{sql-client}}, will get exceptions like:
{code:java}
[ERROR] Could not execute SQL statement. Reason:
java.lang.AbstractMethodError: org.apache.flink.streaming.connectors.elasticsearch.ElasticsearchUpsertTableSinkFactoryBase.createElasticsearchUpsertTableSink(ZLorg/apache/flink/table/api/TableSchema;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/apache/flink/api/common/serialization/SerializationSchema;Lorg/apache/flink/elasticsearch6/shaded/org/elasticsearch/common/xcontent/XContentType;Lorg/apache/flink/streaming/connectors/elasticsearch/ActionRequestFailureHandler;Ljava/util/Map;)Lorg/apache/flink/streaming/connectors/elasticsearch/ElasticsearchUpsertTableSinkBase;
{code}
After analyzing the exceptions, IMO, it's because {{flink-connector-elasticsearch-base}} is included into both {{flink-sql-connector-elasticsearch6}} and {{flink-sql-connector-elasticsearch7. And }}{{flink-connector-elasticsearch-base}}{{ has different implementation in 6 & 7, because the version of elastic-search is different.}}
{{A simple way for fix this is we relocation }}{{flink-connector-elasticsearch-base in }}{{flink-sql-connector-elasticsearch6}}{{ and }}{{flink-sql-connector-elasticsearch7. For example for }}{{flink-sql-connector-elasticsearch7:}}{{}}
{code:java}
<relocation>
<pattern>org.apache.flink.streaming.connectors.elasticsearch.</pattern>
<shadedPattern>org.apache.flink.streaming.connectors.elasticsearch7.base.</shadedPattern>
</relocation>
{code}
{{cc [~jark] [~twalthr] }}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)