-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove JDBC dependency on ES lib core (#82162)
As part of the effort of making JDBC driver self sufficient, remove the ES lib core dependencies by light cloning the couple the utility classes needed (and their dependencies). In additional provide a shim layer that adapts the sql-proto Protocol constant class by introducing a sql-action Protocol class, which is ES aware. To avoid name collision sql-proto has been renamed to CoreProtocol which is used at the driver level, while Protocol is used within ES. Relates #82077
- Loading branch information
Showing
50 changed files
with
555 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/ProtoShim.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.action; | ||
|
||
import org.elasticsearch.core.TimeValue; | ||
|
||
/** | ||
* Utility class that handles conversion of classes in sql-proto (without any Elasticsearch dependencies) | ||
* into sql-action which do depend on Elasticsearch (since they are meant to be used in this environment). | ||
*/ | ||
final class ProtoShim { | ||
|
||
private ProtoShim() {} | ||
|
||
static TimeValue fromProto(org.elasticsearch.xpack.sql.proto.core.TimeValue protoTimeValue) { | ||
if (protoTimeValue == null) { | ||
return null; | ||
} | ||
return new TimeValue(protoTimeValue.duration(), protoTimeValue.timeUnit()); | ||
} | ||
|
||
static org.elasticsearch.xpack.sql.proto.core.TimeValue toProto(TimeValue timeValue) { | ||
if (timeValue == null) { | ||
return null; | ||
} | ||
return new org.elasticsearch.xpack.sql.proto.core.TimeValue(timeValue.duration(), timeValue.timeUnit()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/Protocol.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.action; | ||
|
||
import org.elasticsearch.core.TimeValue; | ||
import org.elasticsearch.xpack.sql.proto.CoreProtocol; | ||
|
||
import static org.elasticsearch.xpack.sql.action.ProtoShim.fromProto; | ||
|
||
/** | ||
* Sql protocol defaults used for sharding constants across the code base both in server and clients. | ||
* Expands and converts some constants from the sql-proto CoreProtocol class which has NO dependencies to ES. | ||
*/ | ||
public final class Protocol extends CoreProtocol { | ||
|
||
/** | ||
* Global choice for the default fetch size. | ||
*/ | ||
public static final TimeValue REQUEST_TIMEOUT = fromProto(CoreProtocol.REQUEST_TIMEOUT); | ||
public static final TimeValue PAGE_TIMEOUT = fromProto(CoreProtocol.PAGE_TIMEOUT); | ||
|
||
public static final TimeValue DEFAULT_KEEP_ALIVE = fromProto(CoreProtocol.DEFAULT_KEEP_ALIVE); | ||
public static final TimeValue DEFAULT_WAIT_FOR_COMPLETION_TIMEOUT = fromProto(CoreProtocol.DEFAULT_WAIT_FOR_COMPLETION_TIMEOUT); | ||
public static final TimeValue MIN_KEEP_ALIVE = fromProto(CoreProtocol.MIN_KEEP_ALIVE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.