use of org.apache.calcite.jdbc.DynamicRootSchema in project drill by apache.
the class DrillValidator method replaceAliasWithActualName.
private void replaceAliasWithActualName(SqlIdentifier tempNode) {
CalciteSchema schema = getCatalogReader().getRootSchema();
if (schema instanceof DynamicRootSchema) {
DynamicRootSchema rootSchema = (DynamicRootSchema) schema;
String alias = SchemaPath.getCompoundPath(tempNode.names.toArray(new String[0])).toExpr();
SchemaPath actualPath = rootSchema.resolveTableAlias(alias);
if (actualPath != null) {
List<String> names = new ArrayList<>();
PathSegment pathSegment = actualPath.getRootSegment();
while (pathSegment != null) {
names.add(pathSegment.getNameSegment().getPath());
pathSegment = pathSegment.getChild();
}
changeNames(tempNode, names);
}
}
}
Aggregations