Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman committed Oct 9, 2024
1 parent fc0279b commit 8cd982b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.doris.common.UserException;
import org.apache.doris.common.util.TimeUtils;
import org.apache.doris.datasource.hive.HMSExternalTable;
import org.apache.doris.nereids.exceptions.NotSupportedException;
import org.apache.doris.planner.AggregationNode;
import org.apache.doris.planner.AnalyticEvalNode;
import org.apache.doris.planner.PlanNode;
Expand Down Expand Up @@ -846,11 +847,14 @@ public TableRef resolveTableRef(TableRef tableRef) throws AnalysisException {
// Now hms table only support a bit of table kinds in the whole hive system.
// So Add this strong checker here to avoid some undefine behaviour in doris.
if (table.getType() == TableType.HMS_EXTERNAL_TABLE) {
if (!((HMSExternalTable) table).isSupportedHmsTable()) {
try {
((HMSExternalTable) table).isSupportedHmsTable();
} catch (NotSupportedException e) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_NONSUPPORT_HMS_TABLE,
table.getName(),
((HMSExternalTable) table).getDbName(),
tableName.getCtl());
tableName.getCtl(),
e.getMessage());
}
if (Config.enable_query_hive_views) {
if (((HMSExternalTable) table).isView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ public enum ErrorCode {
ERR_CATALOG_ACCESS_DENIED(5087, new byte[]{'4', '2', '0', '0', '0'},
"Access denied for user '%s' to catalog '%s'"),
ERR_NONSUPPORT_HMS_TABLE(5088, new byte[]{'4', '2', '0', '0', '0'},
"Nonsupport hive metastore table named '%s' in database '%s' with catalog '%s'."),
"Nonsupport hive metastore table named '%s' in database '%s' with catalog '%s'. %s"),
ERR_TABLE_NAME_LENGTH_LIMIT(5089, new byte[]{'4', '2', '0', '0', '0'}, "Table name length exceeds limit, "
+ "the length of table name '%s' is %d which is greater than the configuration 'table_name_length_limit' (%d)."),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,11 @@ public HMSExternalTable(long id, String name, String dbName, HMSExternalCatalog
super(id, name, catalog, dbName, TableType.HMS_EXTERNAL_TABLE);
}

// Will throw NotSupportedException if not supported hms table.
// Otherwise, return true.
public boolean isSupportedHmsTable() {
try {
makeSureInitialized();
return true;
} catch (NotSupportedException e) {
LOG.warn("Not supported hms table, message: {}", e.getMessage());
return false;
}
makeSureInitialized();
return true;
}

protected synchronized void makeSureInitialized() {
Expand All @@ -191,6 +188,7 @@ protected synchronized void makeSureInitialized() {
} else if (supportedHiveTable()) {
dlaType = DLAType.HIVE;
} else {
// Should not reach here. Because `supportedHiveTable` will throw exception if not return true.
throw new NotSupportedException("Unsupported dlaType for table: " + getNameWithFullQualifiers());
}
}
Expand Down

0 comments on commit 8cd982b

Please sign in to comment.