Fix broken "Show cubes" functionality when associated table was not found.

This commit is contained in:
Sundar Annamalai 2021-06-25 14:51:43 -04:00
parent 714d380da3
commit 03d807338f
2 changed files with 6 additions and 2 deletions

View File

@ -291,8 +291,11 @@ final class ShowQueriesRewrite
QualifiedObjectName qualifiedTableName = QualifiedObjectName.valueOf(cubeMetadata.getSourceTableName());
Map<QualifiedObjectName, Long> tableLastModifiedTimeMap = new HashMap<>();
long tableLastModifiedTime = tableLastModifiedTimeMap.computeIfAbsent(qualifiedTableName, ignored -> {
TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName).get();
LongSupplier lastModifiedTimeSupplier = metadata.getTableLastModifiedTimeSupplier(session, tableHandle);
Optional<TableHandle> tableHandle = metadata.getTableHandle(session, qualifiedTableName);
if (!tableHandle.isPresent()) {
return -1L;
}
LongSupplier lastModifiedTimeSupplier = metadata.getTableLastModifiedTimeSupplier(session, tableHandle.get());
return lastModifiedTimeSupplier == null ? -1L : lastModifiedTimeSupplier.getAsLong();
});
CubeStatus status = cubeMetadata.getCubeStatus();

View File

@ -650,6 +650,7 @@ public abstract class AbstractTestStarTreeQueries
computeActual("CREATE CUBE orders_cube_predicate_unsupported_predicate ON orders_table_predicate_unsupported_predicate WITH (AGGREGATIONS=(sum(totalprice)), GROUP=(custkey, orderdate))");
assertQueryFails("INSERT INTO CUBE orders_cube_predicate_unsupported_predicate WHERE orderdate = date '1992-01-01' OR custkey = 100", ".*Cannot support predicate.*");
assertQueryFails("INSERT OVERWRITE CUBE orders_cube_predicate_unsupported_predicate WHERE orderdate = date '1992-01-01' OR custkey = 100", ".*Cannot support predicate.*");
assertQueryFails("INSERT INTO CUBE orders_cube_predicate_unsupported_predicate WHERE orderdate", ".*WHERE clause must evaluate to a boolean:.*");
assertUpdate("DROP TABLE orders_table_predicate_unsupported_predicate");
}