This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 310f8aac633 [bugfix](paimon)add class loader (#30690)
310f8aac633 is described below
commit 310f8aac6333020c525aad50ca745834b1ed6431
Author: wuwenchi <[email protected]>
AuthorDate: Thu Feb 1 17:29:47 2024 +0800
[bugfix](paimon)add class loader (#30690)
#30483
---
.../org/apache/doris/paimon/PaimonJniScanner.java | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git
a/fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java
b/fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java
index ac497776004..fce74a27dc6 100644
---
a/fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java
+++
b/fe/be-java-extensions/paimon-scanner/src/main/java/org/apache/doris/paimon/PaimonJniScanner.java
@@ -60,8 +60,10 @@ public class PaimonJniScanner extends JniScanner {
private long tblId;
private long lastUpdateTime;
private RecordReader.RecordIterator<InternalRow> recordIterator = null;
+ private final ClassLoader classLoader;
public PaimonJniScanner(int batchSize, Map<String, String> params) {
+ this.classLoader = this.getClass().getClassLoader();
LOG.debug("params:{}", params);
this.params = params;
String[] requiredFields = params.get("required_fields").split(",");
@@ -87,9 +89,19 @@ public class PaimonJniScanner extends JniScanner {
@Override
public void open() throws IOException {
- initTable();
- initReader();
- resetDatetimeV2Precision();
+ try {
+ // When the user does not specify hive-site.xml, Paimon will look
for the file from the classpath:
+ // org.apache.paimon.hive.HiveCatalog.createHiveConf:
+ //
`Thread.currentThread().getContextClassLoader().getResource(HIVE_SITE_FILE)`
+ // so we need to provide a classloader, otherwise it will cause
NPE.
+ Thread.currentThread().setContextClassLoader(classLoader);
+ initTable();
+ initReader();
+ resetDatetimeV2Precision();
+ } catch (Exception e) {
+ LOG.warn("Failed to open paimon_scanner: " + e.getMessage(), e);
+ throw e;
+ }
}
private void initReader() throws IOException {
@@ -182,7 +194,7 @@ public class PaimonJniScanner extends JniScanner {
PaimonTableCacheKey key = new PaimonTableCacheKey(ctlId, dbId, tblId,
paimonOptionParams, dbName, tblName);
TableExt tableExt = PaimonTableCache.getTable(key);
if (tableExt.getCreateTime() < lastUpdateTime) {
- LOG.warn("invalidate cacha table:{}, localTime:{}, remoteTime:{}",
key, tableExt.getCreateTime(),
+ LOG.warn("invalidate cache table:{}, localTime:{}, remoteTime:{}",
key, tableExt.getCreateTime(),
lastUpdateTime);
PaimonTableCache.invalidateTableCache(key);
tableExt = PaimonTableCache.getTable(key);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]