@Override public void initCapabilities(Connection connection) throws TranslatorException { super.initCapabilities(connection); if (getVersion().compareTo(ELEVEN_2) >= 0) { AggregateAttributes aa = new AggregateAttributes(); aa.setAllowsOrderBy(true); addPushDownFunction(ORACLE, LISTAGG, STRING, STRING, STRING).setAggregateAttributes(aa); addPushDownFunction(ORACLE, LISTAGG, STRING, STRING).setAggregateAttributes(aa); } }
func.setAggregateAttributes(aa); func.setInvocationMethod(method.getName()); func.setPushdown(PushDown.CAN_PUSHDOWN);
aa.setAllowsDistinct(allowsDistinct); aa.setDecomposable(decomposable); function.setAggregateAttributes(aa);
public Collection<org.teiid.metadata.FunctionMethod> getFunctionMethods() { List<org.teiid.metadata.FunctionMethod> methods = new ArrayList<org.teiid.metadata.FunctionMethod>(); methods.add(new FunctionMethod("xyz", "", "misc", PushDown.MUST_PUSHDOWN, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ FakeFunctionMetadataSource.class.getName(), "xyz", //$NON-NLS-1$ null, new FunctionParameter("out", "integer"), true, Determinism.DETERMINISTIC)); //$NON-NLS-1$ //$NON-NLS-2$ FunctionParameter p1 = new FunctionParameter("astring", "string"); //$NON-NLS-1$ //$NON-NLS-2$ FunctionParameter result = new FunctionParameter("trimstring", "string"); //$NON-NLS-1$ //$NON-NLS-2$ FunctionMethod method = new FunctionMethod("MYRTRIM", "", "", FakeFunctionMetadataSource.class.getName(), "myrtrim", new FunctionParameter[] {p1}, result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ method.setPushdown(PushDown.CAN_PUSHDOWN); methods.add(method); FunctionMethod method2 = new FunctionMethod("misc.namespace.func", "", "", null, null, new FunctionParameter[] {p1}, result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ method2.setPushdown(PushDown.MUST_PUSHDOWN); methods.add(method2); FunctionMethod method3 = new FunctionMethod("parsedate_", "", "", null, null, new FunctionParameter[] {p1}, new FunctionParameter("", DataTypeManager.DefaultDataTypes.DATE)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ method3.setPushdown(PushDown.MUST_PUSHDOWN); methods.add(method3); FunctionMethod method4 = new FunctionMethod("FIRST_VALUE", "", "", null, null, new FunctionParameter[] {p1},result); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ method4.setPushdown(PushDown.MUST_PUSHDOWN); method4.setAggregateAttributes(new AggregateAttributes()); methods.add(method4); return methods; }
private FunctionMethod addAgg(Schema s, String name, Class<?> clazz, String returns) { FunctionMethod fm = new FunctionMethod(); fm.setName(name); fm.setInvocationClass(clazz.getName()); fm.setInvocationMethod("addInput"); FunctionParameter fp = new FunctionParameter(); fp.setType(DataTypeManager.DefaultDataTypes.INTEGER); fp.setName("arg"); fp.setVarArg(true); fm.getInputParameters().add(fp); FunctionParameter fpout = new FunctionParameter(); fpout.setType(returns); fpout.setName("outp"); fm.setOutputParameter(fpout); AggregateAttributes aa = new AggregateAttributes(); fm.setAggregateAttributes(aa); s.getFunctions().put(fm.getName(), fm); return fm; }
fm.setAggregateAttributes(aa); result.add(fm);
fm.setAggregateAttributes(aa); result.add(fm);
fm.setAggregateAttributes(aa); result.add(fm);