diff --git a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnector.java b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnector.java index f73c5b0a218f9..276ff3f7bc7be 100644 --- a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnector.java +++ b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnector.java @@ -81,6 +81,10 @@ public ConnectorRecordSetProvider getRecordSetProvider() { return recordSetProvider; } + public void initConnectorCache() throws Exception { + PulsarConnectorCache.getConnectorCache(pulsarConnectorConfig); + } + @Override public final void shutdown() { try { diff --git a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnectorFactory.java b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnectorFactory.java index 48d10814eed10..0da2596b55088 100644 --- a/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnectorFactory.java +++ b/pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarConnectorFactory.java @@ -67,7 +67,9 @@ public Connector create(String connectorId, Map config, Connecto .setRequiredConfigurationProperties(config) .initialize(); - return injector.getInstance(PulsarConnector.class); + PulsarConnector connector = injector.getInstance(PulsarConnector.class); + connector.initConnectorCache(); + return connector; } catch (Exception e) { throwIfUnchecked(e); throw new RuntimeException(e);