use of io.crate.metadata.FunctionType in project crate by crate.
the class SplitPointsBuilder method visitFunction.
@Override
public Void visitFunction(Function function, Context context) {
FunctionType type = function.type();
switch(type) {
case SCALAR:
super.visitFunction(function, context);
return null;
case AGGREGATE:
context.foundAggregateOrTableFunction = true;
context.allocateAggregate(function);
context.insideAggregate = true;
super.visitFunction(function, context);
context.insideAggregate = false;
return null;
case TABLE:
if (context.insideAggregate) {
throw new UnsupportedOperationException("Cannot use table functions inside aggregates");
}
context.foundAggregateOrTableFunction = true;
if (context.tableFunctionLevel == 0) {
context.allocateTableFunction(function);
}
context.tableFunctionLevel++;
super.visitFunction(function, context);
context.tableFunctionLevel--;
return null;
default:
throw new UnsupportedOperationException("Invalid function type: " + type);
}
}
Aggregations