use of org.teiid.language.SortSpecification.Ordering in project teiid by teiid.
the class LanguageBridgeFactory method translate.
public org.teiid.language.OrderBy translate(OrderBy orderBy, boolean set) {
if (orderBy == null) {
return null;
}
List<OrderByItem> items = orderBy.getOrderByItems();
List<SortSpecification> translatedItems = new ArrayList<SortSpecification>();
for (int i = 0; i < items.size(); i++) {
Expression symbol = items.get(i).getSymbol();
Ordering direction = items.get(i).isAscending() ? Ordering.ASC : Ordering.DESC;
SortSpecification orderByItem = null;
if (!set && (items.get(i).isUnrelated() || symbol instanceof ElementSymbol)) {
orderByItem = new SortSpecification(direction, translate(symbol));
} else {
orderByItem = new SortSpecification(direction, new ColumnReference(null, Symbol.getShortName(((Symbol) symbol).getOutputName()), null, symbol.getType()));
}
orderByItem.setNullOrdering(items.get(i).getNullOrdering());
translatedItems.add(orderByItem);
}
return new org.teiid.language.OrderBy(translatedItems);
}
Aggregations