protected TupleDescriptor visitShowTables(ShowTables showTables, AnalysisContext context)
{
String catalogName = session.getCatalog();
String schemaName = session.getSchema();
QualifiedName schema = showTables.getSchema();
if (schema != null) {
List<String> parts = schema.getParts();
if (parts.size() > 2) {
throw new SemanticException(INVALID_SCHEMA_NAME, showTables, "too many parts in schema name: %s", schema);
}
if (parts.size() == 2) {
catalogName = parts.get(0);
}
schemaName = schema.getSuffix();
}
// TODO: throw SemanticException if schema does not exist
Expression predicate = equal(nameReference("table_schema"), new StringLiteral(schemaName));