Skip to content

Commit

Permalink
TEIID-2665 removing pushdown checks from UserDefined
Browse files Browse the repository at this point in the history
  • Loading branch information
shawkins committed Oct 7, 2013
1 parent 7795bb4 commit f159110
Showing 1 changed file with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
import org.teiid.metadata.FunctionMethod.PushDown;
import org.teiid.query.function.FunctionDescriptor;
import org.teiid.query.util.CommandContext;

Expand All @@ -41,9 +40,7 @@ public class UserDefined extends AggregateFunction {

public UserDefined(FunctionDescriptor functionDescriptor) {
this.fd = functionDescriptor;
if (this.fd.getPushdown() == PushDown.CAN_PUSHDOWN || this.fd.getPushdown() == PushDown.CANNOT_PUSHDOWN) {
this.instance = (UserDefinedAggregate<?>) fd.newInstance();
}
this.instance = (UserDefinedAggregate<?>) fd.newInstance();
}

@Override
Expand All @@ -58,26 +55,19 @@ public void addInputDirect(List<?> tuple, CommandContext commandContext) throws
for (int i = 0; i < argIndexes.length; i++) {
values[i + (fd.requiresContext()?1:0)] = tuple.get(argIndexes[i]);
}
if (this.fd.getPushdown() == PushDown.CAN_PUSHDOWN || this.fd.getPushdown() == PushDown.CANNOT_PUSHDOWN) {
fd.invokeFunction(values, commandContext, instance);
}
fd.invokeFunction(values, commandContext, instance);
}

@Override
public void reset() {
if (this.fd.getPushdown() == PushDown.CAN_PUSHDOWN || this.fd.getPushdown() == PushDown.CANNOT_PUSHDOWN) {
instance.reset();
}
instance.reset();
}

@Override
public Object getResult(CommandContext commandContext) throws FunctionExecutionException,
ExpressionEvaluationException, TeiidComponentException,
TeiidProcessingException {
if (this.fd.getPushdown() == PushDown.CAN_PUSHDOWN || this.fd.getPushdown() == PushDown.CANNOT_PUSHDOWN) {
return instance.getResult(commandContext);
}
return values[0];
return instance.getResult(commandContext);
}

@Override
Expand Down

0 comments on commit f159110

Please sign in to comment.