Skip to content
Merged
Show file tree
Hide file tree
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 @@ -382,6 +382,12 @@ default List<String> getFullQualifiers() {
getName());
}

default String getNameWithFullQualifiers() {
return String.format("%s.%s.%s", getDatabase().getCatalog().getName(),
ClusterNamespace.getNameFromFullName(getDatabase().getFullName()),
getName());
}

default boolean isManagedTable() {
return getType() == TableType.OLAP || getType() == TableType.MATERIALIZED_VIEW;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.doris.datasource.HMSExternalCatalog;
import org.apache.doris.datasource.hive.HMSCachedClient;
import org.apache.doris.datasource.hive.HiveMetaStoreCache;
import org.apache.doris.nereids.exceptions.NotSupportedException;
import org.apache.doris.statistics.AnalysisInfo;
import org.apache.doris.statistics.BaseAnalysisTask;
import org.apache.doris.statistics.ColumnStatistic;
Expand Down Expand Up @@ -136,16 +137,21 @@ public HMSExternalTable(long id, String name, String dbName, HMSExternalCatalog
}

public boolean isSupportedHmsTable() {
makeSureInitialized();
return dlaType != DLAType.UNKNOWN;
try {
makeSureInitialized();
return true;
} catch (NotSupportedException e) {
LOG.warn("Not supported hms table, message: {}", e.getMessage());
return false;
}
}

protected synchronized void makeSureInitialized() {
super.makeSureInitialized();
if (!objectCreated) {
remoteTable = ((HMSExternalCatalog) catalog).getClient().getTable(dbName, name);
if (remoteTable == null) {
dlaType = DLAType.UNKNOWN;
throw new IllegalArgumentException("Hms table not exists, table: " + getNameWithFullQualifiers());
} else {
if (supportedIcebergTable()) {
dlaType = DLAType.ICEBERG;
Expand All @@ -154,7 +160,7 @@ protected synchronized void makeSureInitialized() {
} else if (supportedHiveTable()) {
dlaType = DLAType.HIVE;
} else {
dlaType = DLAType.UNKNOWN;
throw new NotSupportedException("Unsupported dlaType for table: " + getNameWithFullQualifiers());
}
}
objectCreated = true;
Expand Down Expand Up @@ -201,12 +207,8 @@ private boolean supportedHiveTable() {
if (inputFileFormat == null) {
return false;
}
boolean supportedFileFormat = SUPPORTED_HIVE_FILE_FORMATS.contains(inputFileFormat);
if (!supportedFileFormat) {
throw new IllegalArgumentException("Unsupported hive input format: " + inputFileFormat);
}
LOG.debug("hms table {} is {} with file format: {}", name, remoteTable.getTableType(), inputFileFormat);
return true;
return SUPPORTED_HIVE_FILE_FORMATS.contains(inputFileFormat);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

package org.apache.doris.datasource;

import org.apache.doris.catalog.Type;
import org.apache.doris.catalog.external.HMSExternalTable;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.Config;
import org.apache.doris.common.ThreadPoolManager;
import org.apache.doris.datasource.hive.HiveMetaStoreCache;
import org.apache.doris.fs.FileSystemCache;
import org.apache.doris.nereids.exceptions.NotSupportedException;
import org.apache.doris.planner.external.hudi.HudiPartitionMgr;
import org.apache.doris.planner.external.hudi.HudiPartitionProcessor;
import org.apache.doris.planner.external.iceberg.IcebergMetadataCache;
Expand Down Expand Up @@ -172,7 +174,14 @@ public void addPartitionsCache(long catalogId, HMSExternalTable table, List<Stri
String dbName = ClusterNamespace.getNameFromFullName(table.getDbName());
HiveMetaStoreCache metaCache = cacheMap.get(catalogId);
if (metaCache != null) {
metaCache.addPartitionsCache(dbName, table.getName(), partitionNames, table.getPartitionColumnTypes());
List<Type> partitionColumnTypes;
try {
partitionColumnTypes = table.getPartitionColumnTypes();
} catch (NotSupportedException e) {
LOG.warn("Ignore not supported hms table, message: {} ", e.getMessage());
return;
}
metaCache.addPartitionsCache(dbName, table.getName(), partitionNames, partitionColumnTypes);
}
LOG.debug("add partition cache for {}.{} in catalog {}", dbName, table.getName(), catalogId);
}
Expand Down