Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(",");
Expand All @@ -87,9 +89,19 @@ public PaimonJniScanner(int batchSize, Map<String, String> params) {

@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 {
Expand Down Expand Up @@ -182,7 +194,7 @@ private void initTable() {
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);
Expand Down