if (!hasQueryKey) {
return null;
}
if (getContainingDescriptor() == null) {
// Assign an artificial query key to represent the alias.
DirectQueryKey alias = new DirectQueryKey();
alias.setField(new DatabaseField(this.name));
ReportQuery subQuery = ((FromSubSelectExpression)getBaseExpression()).getSubSelect().getSubQuery();
alias.setDescriptor(subQuery.getDescriptor());
this.queryKey = alias;
return alias;
}
return super.getQueryKeyOrNull();
}