use of org.apache.cassandra.db.KeyspaceNotDefinedException in project cassandra by apache.
the class Schema method validateTable.
public TableMetadata validateTable(String keyspaceName, String tableName) {
if (tableName.isEmpty())
throw new InvalidRequestException("non-empty table is required");
KeyspaceMetadata keyspace = keyspaces.getNullable(keyspaceName);
if (keyspace == null)
throw new KeyspaceNotDefinedException(format("keyspace %s does not exist", keyspaceName));
TableMetadata metadata = keyspace.getTableOrViewNullable(tableName);
if (metadata == null)
throw new InvalidRequestException(format("table %s does not exist", tableName));
return metadata;
}
Aggregations