RowExpression result = new Visitor(types, metadata, session.getTimeZoneKey()).process(expression, null);
Preconditions.checkNotNull(result, "translated expression is null");
if (optimize) {
ExpressionOptimizer optimizer = new ExpressionOptimizer(metadata.getFunctionRegistry(), metadata.getTypeManager(), session);
return optimizer.optimize(result);
}
return result;
}