Skip to content

Commit 801c2ac

Browse files
authored
SQL: Remove JDBC dependency on ES XContent lib (#82225) (#82267)
Remove JDBC driver dependency on XContent by cloning the necessary classes into the driver. This has the advantage of keeping the parsing/writing code style in sync and hopefully making maintenance easier in the future at the cost of bringing over a lot of code that is potentially unnecessary. The imported classes were kept as close as possible to the original and placed under a different package. Noteable exception is JDBC XContentBuilder which exposes its internal generator to allow unwrapping inside sql-action. The bridging between XContent in ES and JDBC is done in sql-action through ProtoShim which relies on delegation to allow ES XContent to be used inside the JDBC classes. Fix #80277
1 parent a76a04d commit 801c2ac

File tree

87 files changed

+7902
-1679
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+7902
-1679
lines changed

x-pack/plugin/sql/jdbc/build.gradle

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,11 @@ tasks.named('forbiddenApisMain').configure {
1111
}
1212

1313
dependencies {
14-
api(xpackProject('plugin:sql:sql-client')) {
15-
transitive = false
16-
}
17-
api(xpackProject('plugin:sql:sql-proto')) {
18-
transitive = false
19-
}
20-
api(project(':libs:elasticsearch-x-content')) {
21-
transitive = false
22-
}
23-
// required by x-content
24-
runtimeOnly project(':libs:elasticsearch-core')
25-
api "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
26-
runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
14+
api xpackProject('plugin:sql:sql-client')
2715
testImplementation project(":test:framework")
2816
testImplementation(testArtifact(project(xpackModule('core'))))
2917
}
3018

31-
tasks.named("dependencyLicenses").configure {
32-
mapping from: /jackson-.*/, to: 'jackson'
33-
}
3419

3520
tasks.named("shadowJar").configure {
3621
relocate 'com.fasterxml', 'shadow.fasterxml'
@@ -40,13 +25,6 @@ tasks.named("shadowJar").configure {
4025
}
4126
}
4227

43-
tasks.named("thirdPartyAudit").configure {
44-
ignoreMissingClasses(
45-
'com.fasterxml.jackson.databind.ObjectMapper',
46-
'com.fasterxml.jackson.databind.cfg.MapperBuilder'
47-
)
48-
}
49-
5028
tasks.named("test").configure {
5129
// reset the unit test classpath as using the shadow jar won't work due to relocated packages
5230
classpath = sourceSets.test.runtimeClasspath

x-pack/plugin/sql/jdbc/licenses/jackson-LICENSE

Lines changed: 0 additions & 8 deletions
This file was deleted.

x-pack/plugin/sql/jdbc/licenses/jackson-NOTICE

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/sql/jdbc/licenses/jackson-core-2.10.4.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

x-pack/plugin/sql/jdbc/src/main/java/org/elasticsearch/xpack/sql/jdbc/XContentSqlExtension.java

Lines changed: 0 additions & 40 deletions
This file was deleted.

x-pack/plugin/sql/jdbc/src/main/resources/META-INF/services/org.elasticsearch.xcontent.XContentBuilderExtension

Lines changed: 0 additions & 1 deletion
This file was deleted.

x-pack/plugin/sql/sql-action/build.gradle

Lines changed: 1 addition & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ dependencies {
2020
api xpackProject('plugin:core')
2121
api xpackProject('plugin:ql')
2222
api xpackProject('plugin:sql:sql-proto')
23-
api "org.apache.lucene:lucene-core:${versions.lucene}"
24-
api "joda-time:joda-time:2.10.10"
25-
runtimeOnly "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
26-
runtimeOnly "org.apache.logging.log4j:log4j-api:${versions.log4j}"
27-
runtimeOnly "org.apache.logging.log4j:log4j-core:${versions.log4j}"
2823

2924
testImplementation project(":test:framework")
3025
testImplementation(project(xpackModule('ql:test-fixtures')))
@@ -38,89 +33,4 @@ tasks.named('forbiddenApisMain').configure {
3833
tasks.named("dependencyLicenses").configure {
3934
mapping from: /jackson-.*/, to: 'jackson'
4035
mapping from: /lucene-.*/, to: 'lucene'
41-
}
42-
43-
tasks.named("thirdPartyAudit").configure {
44-
ignoreMissingClasses(
45-
//'com.fasterxml.jackson.dataformat.yaml.YAMLMapper',
46-
47-
// from com.fasterxml.jackson.dataformat.yaml.YAMLMapper (jackson-dataformat-yaml)
48-
'com.fasterxml.jackson.databind.ObjectMapper',
49-
'org.fusesource.jansi.Ansi',
50-
'org.fusesource.jansi.AnsiRenderer$Code',
51-
52-
// from log4j
53-
'com.conversantmedia.util.concurrent.SpinPolicy',
54-
'com.fasterxml.jackson.annotation.JsonInclude$Include',
55-
'com.fasterxml.jackson.databind.DeserializationContext',
56-
'com.fasterxml.jackson.databind.DeserializationFeature',
57-
'com.fasterxml.jackson.databind.JsonMappingException',
58-
'com.fasterxml.jackson.databind.JsonNode',
59-
'com.fasterxml.jackson.databind.Module$SetupContext',
60-
'com.fasterxml.jackson.databind.ObjectReader',
61-
'com.fasterxml.jackson.databind.ObjectWriter',
62-
'com.fasterxml.jackson.databind.SerializerProvider',
63-
'com.fasterxml.jackson.databind.deser.std.StdDeserializer',
64-
'com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer',
65-
'com.fasterxml.jackson.databind.module.SimpleModule',
66-
'com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter',
67-
'com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider',
68-
'com.fasterxml.jackson.databind.ser.std.StdScalarSerializer',
69-
'com.fasterxml.jackson.databind.ser.std.StdSerializer',
70-
'com.fasterxml.jackson.dataformat.xml.JacksonXmlModule',
71-
'com.fasterxml.jackson.dataformat.xml.XmlMapper',
72-
'com.fasterxml.jackson.dataformat.xml.util.DefaultXmlPrettyPrinter',
73-
'com.lmax.disruptor.EventFactory',
74-
'com.lmax.disruptor.EventTranslator',
75-
'com.lmax.disruptor.EventTranslatorTwoArg',
76-
'com.lmax.disruptor.EventTranslatorVararg',
77-
'com.lmax.disruptor.ExceptionHandler',
78-
'com.lmax.disruptor.LifecycleAware',
79-
'com.lmax.disruptor.RingBuffer',
80-
'com.lmax.disruptor.Sequence',
81-
'com.lmax.disruptor.SequenceReportingEventHandler',
82-
'com.lmax.disruptor.WaitStrategy',
83-
'com.lmax.disruptor.dsl.Disruptor',
84-
'com.lmax.disruptor.dsl.ProducerType',
85-
'javax.jms.Connection',
86-
'javax.jms.ConnectionFactory',
87-
'javax.jms.Destination',
88-
'javax.jms.JMSException',
89-
'javax.jms.MapMessage',
90-
'javax.jms.Message',
91-
'javax.jms.MessageConsumer',
92-
'javax.jms.MessageProducer',
93-
'javax.jms.Session',
94-
'javax.mail.Authenticator',
95-
'javax.mail.Message$RecipientType',
96-
'javax.mail.PasswordAuthentication',
97-
'javax.mail.Session',
98-
'javax.mail.Transport',
99-
'javax.mail.internet.InternetAddress',
100-
'javax.mail.internet.InternetHeaders',
101-
'javax.mail.internet.MimeMessage',
102-
'javax.mail.internet.MimeMultipart',
103-
'javax.mail.internet.MimeUtility',
104-
'org.apache.commons.compress.compressors.CompressorStreamFactory',
105-
'org.apache.commons.compress.utils.IOUtils',
106-
'org.apache.commons.csv.CSVFormat',
107-
'org.apache.commons.csv.QuoteMode',
108-
'org.apache.kafka.clients.producer.Producer',
109-
'org.apache.kafka.clients.producer.RecordMetadata',
110-
'org.codehaus.stax2.XMLStreamWriter2',
111-
'org.jctools.queues.MpscArrayQueue',
112-
'org.osgi.framework.Bundle',
113-
'org.osgi.framework.BundleActivator',
114-
'org.osgi.framework.BundleContext',
115-
'org.osgi.framework.BundleEvent',
116-
'org.osgi.framework.BundleReference',
117-
'org.osgi.framework.FrameworkUtil',
118-
'org.osgi.framework.ServiceRegistration',
119-
'org.osgi.framework.SynchronousBundleListener',
120-
'org.osgi.framework.wiring.BundleWire',
121-
'org.osgi.framework.wiring.BundleWiring',
122-
'org.zeromq.ZMQ$Context',
123-
'org.zeromq.ZMQ$Socket',
124-
'org.zeromq.ZMQ'
125-
)
126-
}
36+
}

x-pack/plugin/sql/sql-action/licenses/jackson-LICENSE

Lines changed: 0 additions & 8 deletions
This file was deleted.

x-pack/plugin/sql/sql-action/licenses/jackson-NOTICE

Lines changed: 0 additions & 20 deletions
This file was deleted.

x-pack/plugin/sql/sql-action/licenses/jackson-core-2.10.4.jar.sha1

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)