use of org.apache.drill.exec.planner.sql.parser.SqlDropAllAliases in project drill by apache.
the class DropAllAliasesHandler method getPlan.
@Override
public PhysicalPlan getPlan(SqlNode sqlNode) throws ForemanSetupException, IOException {
checkAliasesEnabled();
SqlDropAllAliases node = unwrap(sqlNode, SqlDropAllAliases.class);
String aliasTarget = ((SqlLiteral) node.getAliasKind()).toValue();
AliasRegistry aliasRegistry = getAliasRegistry(aliasTarget);
boolean isPublicAlias = ((SqlLiteral) node.getIsPublic()).booleanValue();
if (isPublicAlias) {
deletePublicAliases(node.getUser(), aliasRegistry);
} else {
deleteUserAliases(node.getUser(), aliasRegistry);
}
return DirectPlan.createDirectPlan(context, true, String.format("%s aliases dropped successfully", StringUtils.capitalize(aliasTarget.toLowerCase(Locale.ROOT))));
}
Aggregations