Skip to content

Commit 1adc690

Browse files
committed
Use XmlMapper instead of ObjectMapper
1 parent 84676df commit 1adc690

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

plugin/trino-vertica/src/main/java/io/trino/plugin/vertica/VerticaTableStatisticsReader.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
import com.fasterxml.jackson.annotation.JsonCreator;
1818
import com.fasterxml.jackson.annotation.JsonProperty;
1919
import com.fasterxml.jackson.core.JsonProcessingException;
20-
import com.fasterxml.jackson.databind.ObjectMapper;
21-
import com.fasterxml.jackson.dataformat.xml.JacksonXmlModule;
2220
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
2321
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
2422
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
@@ -56,8 +54,9 @@ public final class VerticaTableStatisticsReader
5654
{
5755
private static final Logger log = Logger.get(VerticaTableStatisticsReader.class);
5856

59-
private static final ObjectMapper OBJECT_MAPPER = new XmlMapper(new JacksonXmlModule())
60-
.disable(FAIL_ON_IGNORED_PROPERTIES, FAIL_ON_UNKNOWN_PROPERTIES);
57+
private static final XmlMapper XML_MAPPER = (XmlMapper) new XmlMapper()
58+
.disable(FAIL_ON_IGNORED_PROPERTIES)
59+
.disable(FAIL_ON_UNKNOWN_PROPERTIES);
6160

6261
// We don't know null fraction in case of nan and null rows, but having no null fraction will make CBO useless. Assume some arbitrary value.
6362
private static final Estimate UNKNOWN_NULL_FRACTION_REPLACEMENT = Estimate.of(0.1);
@@ -216,7 +215,7 @@ Schema getSchemaStatistics(JdbcTableHandle table)
216215
.map((rs, ctx) -> {
217216
try {
218217
String exportStatistics = rs.getString("EXPORT_STATISTICS");
219-
return OBJECT_MAPPER.readValue(exportStatistics, Schema.class);
218+
return XML_MAPPER.readValue(exportStatistics, Schema.class);
220219
}
221220
catch (JsonProcessingException e) {
222221
log.warn(e, "Failed to read statistics");

0 commit comments

Comments
 (0)