}
// TODO: temporary addition to infer result type from expression. fix this with the new planner refactoring (martint)
private Type extractType(Expression expression)
{
ExpressionAnalyzer expressionAnalyzer = new ExpressionAnalyzer(new Analysis(), session, metadata, experimentalSyntaxEnabled);
List<Field> fields = IterableTransformer.<Symbol>on(DependencyExtractor.extractUnique(expression))
.transform(new Function<Symbol, Field>()
{
@Override
public Field apply(Symbol symbol)
{
return Field.newUnqualified(symbol.getName(), symbolAllocator.getTypes().get(symbol));
}
})
.list();
return expressionAnalyzer.analyze(expression, new TupleDescriptor(fields), new AnalysisContext());
}